Ronald Chen created MCHECKSTYLE-183:
---------------------------------------

             Summary: Checkstyle fails to compile assignment of anonymous class 
with generics
                 Key: MCHECKSTYLE-183
                 URL: https://jira.codehaus.org/browse/MCHECKSTYLE-183
             Project: Maven 2.x Checkstyle Plugin
          Issue Type: Bug
    Affects Versions: 2.9.1
         Environment: Apache Maven 3.0.4 (r1232337; 2012-01-17 00:44:56-0800)
Maven home: /home/rchen/dev/tools/apache-maven-3.0.4
Java version: 1.6.0_26, vendor: Sun Microsystems Inc.
Java home: /home/rchen/dev/tools/jdk1.6.0_26/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "2.6.36-020636-generic", arch: "amd64", family: 
"unix"

            Reporter: Ronald Chen
         Attachments: checkstyles-override-with-generics-fixed.tar.gz

Attached is a repo case where checkstyles fails to compile valid code and hence 
fails.

To run attached code use: mvn checkstyle:check

The checkstyles parser doesn't like code like:
{code}
    CheckstylesOverrideWithGenericsBug assigned = new 
CheckstylesOverrideWithGenericsBug() {
      @Overrdie
      public <SRC> void doStuff(SRC src) {
      }
    };
{code}

The workaround is to remove the generics and use a more specific type.  In the 
attached file I've include two more other cases which don't reproduce the 
problem.

Another problem is checkstyles fails when it fails to parse code.  This is 
horrible.  Checkstyles should skip over files it cannot parse unless you can 
guarantee the checkstyles parser is as good as all other java compilers.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to