You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Debabrat (JIRA)" <ji...@codehaus.org> on 2008/07/23 12:12:26 UTC

[jira] Created: (MPMD-86) Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!

Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!
---------------------------------------------------------------------------------------

                 Key: MPMD-86
                 URL: http://jira.codehaus.org/browse/MPMD-86
             Project: Maven 2.x PMD Plugin
          Issue Type: Bug
          Components: PMD
    Affects Versions: 2.4
         Environment: JAVA 1.5, Maven 2.0.9
            Reporter: Debabrat


While running PMD with Maven i am getting parsing error "Error while parsing ../../../java file"
The errors are
1. Can't use generics unless running in JDK 1.5 mode!
2. Can't use static imports when running in JDK 1.4 mode!
Can't use annotations when running in JDK 1.4 mode!

Any help will be appreciated.
Thanks in advance.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MPMD-86) Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!

Posted by "Bram (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MPMD-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=224054#action_224054 ] 

Bram commented on MPMD-86:
--------------------------

Same here, I've configured the PMD plugin with:
<reporting>
  <plugins>
....
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-pmd-plugin</artifactId>
				<configuration>
					<targetjdk>1.6</targetjdk>
					<rulesets>
						<ruleset>/rulesets/basic.xml</ruleset>
						<ruleset>/rulesets/controversial.xml</ruleset>
					</rulesets>
					<format>xml</format>
					<linkXref>true</linkXref>
					<sourceEncoding>utf-8</sourceEncoding>
					<minimumTokens>100</minimumTokens>
				</configuration>
			</plugin>

And my source builds towards JDK 1.6:
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
		</plugins>
	</build>

With that, I get a lot of warnings on non-1.4 issues like annotations and generics.
After configuring the following project property, these warnings disappeared:

<project>
...
	<properties>
		<targetJdk>1.6</targetJdk>
	</properties>

> Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!
> ---------------------------------------------------------------------------------------
>
>                 Key: MPMD-86
>                 URL: http://jira.codehaus.org/browse/MPMD-86
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.4
>         Environment: JAVA 1.5, Maven 2.0.9
>            Reporter: Debabrat Panda
>            Assignee: Benjamin Bentmann
>
> While running PMD with Maven i am getting parsing error "Error while parsing ../../../java file"
> The errors are
> 1. Can't use generics unless running in JDK 1.5 mode!
> 2. Can't use static imports when running in JDK 1.4 mode!
> Can't use annotations when running in JDK 1.4 mode!
> Any help will be appreciated.
> Thanks in advance.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MPMD-86) Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!

Posted by "Marc Ende (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MPMD-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=210604#action_210604 ] 

Marc Ende commented on MPMD-86:
-------------------------------

I've got the same issue.

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-pmd-plugin</artifactId>
            <version>2.4</version>
            <configuration>
               <rulesets>
                  <ruleset>http://localhost/sonar/rules_configuration/export/java/test/pmd.xml</ruleset>
               </rulesets>
               <configuration>
                  <targetJdk>1.6</targetJdk>
               </configuration>
            </configuration>
         </plugin>

Produces the same errors/warnigns. Even if I have 1.6 in the <source> configuration of the compiler plugin. 

The error only disappears when defining a property, like this:
   <properties>
      <targetJdk>1.6</targetJdk>
   </properties>

I think the plugin (or pmd himself) doesn't respect the settings in the configuration file and relies on an environment variable. 

> Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!
> ---------------------------------------------------------------------------------------
>
>                 Key: MPMD-86
>                 URL: http://jira.codehaus.org/browse/MPMD-86
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.4
>         Environment: JAVA 1.5, Maven 2.0.9
>            Reporter: Debabrat Panda
>            Assignee: Benjamin Bentmann
>
> While running PMD with Maven i am getting parsing error "Error while parsing ../../../java file"
> The errors are
> 1. Can't use generics unless running in JDK 1.5 mode!
> 2. Can't use static imports when running in JDK 1.4 mode!
> Can't use annotations when running in JDK 1.4 mode!
> Any help will be appreciated.
> Thanks in advance.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MPMD-86) Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!

Posted by "Scott MacDonald (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MPMD-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=274821#comment-274821 ] 

Scott MacDonald commented on MPMD-86:
-------------------------------------

How is this closed as "Not a bug" while simultaneously providing a work around for "the bug"?

This is still an issue in maven 3.03 PMD 2.4.



> Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!
> ---------------------------------------------------------------------------------------
>
>                 Key: MPMD-86
>                 URL: https://jira.codehaus.org/browse/MPMD-86
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.4
>         Environment: JAVA 1.5, Maven 2.0.9
>            Reporter: Debabrat Panda
>            Assignee: Benjamin Bentmann
>
> While running PMD with Maven i am getting parsing error "Error while parsing ../../../java file"
> The errors are
> 1. Can't use generics unless running in JDK 1.5 mode!
> 2. Can't use static imports when running in JDK 1.4 mode!
> Can't use annotations when running in JDK 1.4 mode!
> Any help will be appreciated.
> Thanks in advance.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MPMD-86) Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!

Posted by "Greg Knox (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MPMD-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=222569#action_222569 ] 

Greg Knox commented on MPMD-86:
-------------------------------

I think this bug should be reopened; you shouldn't need to set up a targetJdk property in the pom.xml/project/properties element if you already have a targetJdk element in pom.xml/reporting/plugins/plugin/targetJdk .

(JDK1.5, Maven 3.0-SNAPSHOT/0.10.0.20100209-0800 within eclipse 3.5-sr2, maven-pmd-plugin 2.5)

> Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!
> ---------------------------------------------------------------------------------------
>
>                 Key: MPMD-86
>                 URL: http://jira.codehaus.org/browse/MPMD-86
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.4
>         Environment: JAVA 1.5, Maven 2.0.9
>            Reporter: Debabrat Panda
>            Assignee: Benjamin Bentmann
>
> While running PMD with Maven i am getting parsing error "Error while parsing ../../../java file"
> The errors are
> 1. Can't use generics unless running in JDK 1.5 mode!
> 2. Can't use static imports when running in JDK 1.4 mode!
> Can't use annotations when running in JDK 1.4 mode!
> Any help will be appreciated.
> Thanks in advance.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MPMD-86) Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!

Posted by "Paul Sundling (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MPMD-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=160878#action_160878 ] 

Paul Sundling commented on MPMD-86:
-----------------------------------

When running site, it can also give this error if using JDK 1.6 and using targetJdk of 1.6 instead.  It seems to expect <targetJdk>1.5</targetJdk> specifically.

> Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!
> ---------------------------------------------------------------------------------------
>
>                 Key: MPMD-86
>                 URL: http://jira.codehaus.org/browse/MPMD-86
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.4
>         Environment: JAVA 1.5, Maven 2.0.9
>            Reporter: Debabrat Panda
>            Assignee: Benjamin Bentmann
>
> While running PMD with Maven i am getting parsing error "Error while parsing ../../../java file"
> The errors are
> 1. Can't use generics unless running in JDK 1.5 mode!
> 2. Can't use static imports when running in JDK 1.4 mode!
> Can't use annotations when running in JDK 1.4 mode!
> Any help will be appreciated.
> Thanks in advance.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MPMD-86) Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!

Posted by "Benjamin Bentmann (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MPMD-86?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Bentmann closed MPMD-86.
---------------------------------

      Assignee: Benjamin Bentmann
    Resolution: Not A Bug

Most likely, you simply need to set the [target JDK|http://maven.apache.org/plugins/maven-pmd-plugin/examples/targetJdk.html] for the PMD plugin.

If that doesn't solve your problem, please reopen and attach a full debug log from your Maven session for further investigation.

> Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!
> ---------------------------------------------------------------------------------------
>
>                 Key: MPMD-86
>                 URL: http://jira.codehaus.org/browse/MPMD-86
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.4
>         Environment: JAVA 1.5, Maven 2.0.9
>            Reporter: Debabrat Panda
>            Assignee: Benjamin Bentmann
>
> While running PMD with Maven i am getting parsing error "Error while parsing ../../../java file"
> The errors are
> 1. Can't use generics unless running in JDK 1.5 mode!
> 2. Can't use static imports when running in JDK 1.4 mode!
> Can't use annotations when running in JDK 1.4 mode!
> Any help will be appreciated.
> Thanks in advance.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MPMD-86) Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!

Posted by "Scott MacDonald (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MPMD-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=275012#comment-275012 ] 

Scott MacDonald commented on MPMD-86:
-------------------------------------

After confnigruing my pom correcly, the Workaround of setting global <properties><targetJdk>1.6<targetJdk><properties> does actually work for me..  This is still a bug though.   Would be nice if PMD honored compiler jdk version.

> Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!
> ---------------------------------------------------------------------------------------
>
>                 Key: MPMD-86
>                 URL: https://jira.codehaus.org/browse/MPMD-86
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.4
>         Environment: JAVA 1.5, Maven 2.0.9
>            Reporter: Debabrat Panda
>            Assignee: Benjamin Bentmann
>
> While running PMD with Maven i am getting parsing error "Error while parsing ../../../java file"
> The errors are
> 1. Can't use generics unless running in JDK 1.5 mode!
> 2. Can't use static imports when running in JDK 1.4 mode!
> Can't use annotations when running in JDK 1.4 mode!
> Any help will be appreciated.
> Thanks in advance.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MPMD-86) Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!

Posted by "Eugen Paraschiv (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MPMD-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=299239#comment-299239 ] 

Eugen Paraschiv commented on MPMD-86:
-------------------------------------

Honoring the compiler jdk version would make more sense than having to set up the jdk version twice. 
                
> Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!
> ---------------------------------------------------------------------------------------
>
>                 Key: MPMD-86
>                 URL: https://jira.codehaus.org/browse/MPMD-86
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.4
>         Environment: JAVA 1.5, Maven 2.0.9
>            Reporter: Debabrat Panda
>            Assignee: Benjamin Bentmann
>
> While running PMD with Maven i am getting parsing error "Error while parsing ../../../java file"
> The errors are
> 1. Can't use generics unless running in JDK 1.5 mode!
> 2. Can't use static imports when running in JDK 1.4 mode!
> Can't use annotations when running in JDK 1.4 mode!
> Any help will be appreciated.
> Thanks in advance.

--
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

        

[jira] Commented: (MPMD-86) Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!

Posted by "Scott MacDonald (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MPMD-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=274907#comment-274907 ] 

Scott MacDonald commented on MPMD-86:
-------------------------------------

The workaround of setting <properties><targetJdk>1.6<targetJdk><properties>  is not working for me.   This bug still exists in latest maven 3.0.03  PMD 2.4,  has a workaround that does not work in all cases,  and should be reopened.

> Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!
> ---------------------------------------------------------------------------------------
>
>                 Key: MPMD-86
>                 URL: https://jira.codehaus.org/browse/MPMD-86
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.4
>         Environment: JAVA 1.5, Maven 2.0.9
>            Reporter: Debabrat Panda
>            Assignee: Benjamin Bentmann
>
> While running PMD with Maven i am getting parsing error "Error while parsing ../../../java file"
> The errors are
> 1. Can't use generics unless running in JDK 1.5 mode!
> 2. Can't use static imports when running in JDK 1.4 mode!
> Can't use annotations when running in JDK 1.4 mode!
> Any help will be appreciated.
> Thanks in advance.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MPMD-86) Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!

Posted by "Vetle Roeim (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MPMD-86?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=235904#action_235904 ] 

Vetle Roeim commented on MPMD-86:
---------------------------------

I ran into the same thing, seems easy to reproduce. The workaround, i.e. setting the property globally (instead of the configuration property) works.

> Using JDK 1.5 causes ParseException: Can't use generics unless running in JDK 1.5 mode!
> ---------------------------------------------------------------------------------------
>
>                 Key: MPMD-86
>                 URL: http://jira.codehaus.org/browse/MPMD-86
>             Project: Maven 2.x PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 2.4
>         Environment: JAVA 1.5, Maven 2.0.9
>            Reporter: Debabrat Panda
>            Assignee: Benjamin Bentmann
>
> While running PMD with Maven i am getting parsing error "Error while parsing ../../../java file"
> The errors are
> 1. Can't use generics unless running in JDK 1.5 mode!
> 2. Can't use static imports when running in JDK 1.4 mode!
> Can't use annotations when running in JDK 1.4 mode!
> Any help will be appreciated.
> Thanks in advance.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira