Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.6
-
Fix Version/s: 3.0
-
Component/s: PMD
-
Labels:None
-
Environment:Hide$ mvn --version
Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: xxx\apache-maven-3.0.3
Java version: 1.6.0_17, vendor: Sun Microsystems Inc.
Java home: xxx\jdk1.6.0_17\jre
Default locale: de_CH, platform encoding: Cp1252
OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"
PMD plugin configuration:
<artifactId>maven-pmd-plugin</artifactId>
<version>2.6</version>
<configuration>
<linkXRef>false</linkXRef>
<verbose>true</verbose>
<targetJdk>1.5</targetJdk>
<sourceEncoding>UTF-8</sourceEncoding>
</configuration>
Show$ mvn --version Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100) Maven home: xxx\apache-maven-3.0.3 Java version: 1.6.0_17, vendor: Sun Microsystems Inc. Java home: xxx\jdk1.6.0_17\jre Default locale: de_CH, platform encoding: Cp1252 OS name: "windows xp", version: "5.1", arch: "x86", family: "windows" PMD plugin configuration: <artifactId>maven-pmd-plugin</artifactId> <version>2.6</version> <configuration> <linkXRef>false</linkXRef> <verbose>true</verbose> <targetJdk>1.5</targetJdk> <sourceEncoding>UTF-8</sourceEncoding> </configuration>
-
Number of attachments :
Description
The description has been anonymized, but AFAIK, all important details remain. ![]()
On the following code:
Line 155: return super.<SomeClass> someMethod(someArgument);
PMD reports the following problem:
[WARNING] Error while parsing xxx\MyClass.java: Encountered " "<" "< "" at line 155, column 22.
Was expecting:
<IDENTIFIER> ...
I tried the following:
1) Updated PMD maven plugin to 2.6 (I was using 2.5)
2) Verified that the targetJdk setting is taking effect (I get an error when setting it to "xxx")
3) I set the source encoding to UTF-8 (My default is Cp1252)
4) When changing line 155 to "return (Iterable<SomeClass>) super.someMethod(someArgument);", no error is reported
So it seems that Java 5 mode is enabled, but the particular syntax of parameterizing the method call on invocation is not supported.
This is valid syntax, the code is running in production.
Issue Links
- depends upon
-
MPMD-160
Update to PMD 5.0.2
-
This problem does not occur when running the same check in Eclipse, which might suggest the problem is in the maven plugin (not sure).
I could try to provide a patch, but I'm not sure where to begin.