You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[provide a description of the issue]
source level preferences are ignored when the project compliance is different from configured JDK, even if the configured JDK is compatibile with the project compliance.
java.lang.UnsupportedClassVersionError: org/springframework/samples/petclinic/PetClinicApplication has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Expected Result
The applicaiton can be executed successfully
Additional Informations
The text was updated successfully, but these errors were encountered:
So this bug will affects those projects has different source level between that defined in build script (usually defined in build.gradle via sourceCompatibility or pom.xml via configuration.source) and java.configuration.runtimes.
e.g., the project specifies sourceCompatibility = 11 but the default java.configuration.runtimes points JavaSE-17. Since JavaSE-17 is compatible with 11, the project should be imported successfully and set JavaCore.COMPILER_COMPLIANCE = 11 in .settings. But this bug will override these settings. So the project source level will be always set to 17. Not sure if this bug affects a lot of people, and it's already fixed via eclipse-jdtls/eclipse.jdt.ls#2299.
Good catch here. I think the only long term solution is some kind of helper method we can start to use instead of manually calling getOptions(false), putting the new project-specific options in that map, and then setting the project options. I'm just thinking that this kind of bug is likely to be introduced in the future because the behaviour here is not obvious.
[provide a description of the issue]
source level preferences are ignored when the project compliance is different from configured JDK, even if the configured JDK is compatibile with the project compliance.
Environment
Steps To Reproduce
java.configuration.runtimes
sourceCompatibility = 11
in its Gradle build script.Current Result
Expected Result
The applicaiton can be executed successfully
Additional Informations
The text was updated successfully, but these errors were encountered: