JMC-6513: Wrong version of compiled classes when importing JMC maven projects in Eclipse with JDT Default Compiler Level of 11

Langer, Christoph christoph.langer at sap.com
Fri Jun 28 19:57:50 UTC 2019


Ping: Any comments for this?



From: Langer, Christoph
Sent: Donnerstag, 20. Juni 2019 23:56
To: jmc-dev at openjdk.java.net
Subject: JMC-6513: Wrong version of compiled classes when importing JMC maven projects in Eclipse with JDT Default Compiler Level of 11



Hi,



please let me know what you think of this patch:



Bug: https://bugs.openjdk.java.net/browse/JMC-6513

Webrev: http://cr.openjdk.java.net/~clanger/webrevs/JMC-6513.0/



I'm having issues when importing the jmc projects into my Eclipse which has a default JDK compiler level of 11. Although the JMC projects define a JSE18 in their .classpath files, the classes get compiled with Java 11 version. This can be helped by creating ".settings/org.eclipse.jdt.core.prefs" files which set the compiler to 1.8. Then these issues were gone. So, in my patch I propose to add them. A Java compiler level of 8 is needed in Eclipse because I want to be able to run/debug with any JDK down to 8.



Something is a bit weird though with maven import. On my Windows Eclipse I observe that the import would generate these .settings/org.eclipse.jdt.core.prefs as contained in the patch. However, this import also regenerates some .classpath files which brings other issues and is not what is wanted. On my Eclipse on Mac, I don't see neither .settings/org.eclipse.jdt.core.prefs getting generated nor .classpath files rewritten. Maven settings in both Eclipse installations seem to be the same. Does anybody have an explanation for that?



So, AFAICS, I don't think my patch causes any harm and can safely be used. There's also precedence for that such as the projects in jmc/core (which compile with JDK 1.7), as well as project jmc/application/org.openjdk.jmc.osgi.extension which was introduced by the patch for JMC-5859 [1].



Thanks

Christoph



[1] http://hg.openjdk.java.net/jmc/jmc/rev/2cc768144a86





More information about the jmc-dev mailing list