Skip to content

Commit

Permalink
Prototype for eclipse-jdt#1448
Browse files Browse the repository at this point in the history
  • Loading branch information
akurtakov committed Jun 27, 2024
1 parent 5162902 commit 3fdfb39
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;

import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.Messages;

Expand Down Expand Up @@ -422,6 +423,16 @@ public static Map<String, String> getEEOptions(IExecutionEnvironment ee) {
String complianceOption= eeOptions.get(JavaCore.COMPILER_COMPLIANCE);
if (complianceOption == null)
return null;
String latestCompilerVersion= CompilerOptions.getLatestVersion();
if (Integer.parseInt(latestCompilerVersion) < Integer.parseInt(complianceOption)) {
eeOptions.put(JavaCore.COMPILER_COMPLIANCE, latestCompilerVersion);
if(eeOptions.containsKey(JavaCore.COMPILER_SOURCE)) {
eeOptions.put(JavaCore.COMPILER_SOURCE, latestCompilerVersion);
}
if(eeOptions.containsKey(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM)) {
eeOptions.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, latestCompilerVersion);
}
}

// eeOptions can miss some options, make sure they are complete:
HashMap<String, String> options= new HashMap<>();
Expand Down

0 comments on commit 3fdfb39

Please sign in to comment.