diff --git a/subprojects/java-compiler/src/main/java/com/itsaky/androidide/config/JavacConfigProvider.java b/subprojects/java-compiler/src/main/java/com/itsaky/androidide/config/JavacConfigProvider.java index cc9966107..a8ca4ae13 100644 --- a/subprojects/java-compiler/src/main/java/com/itsaky/androidide/config/JavacConfigProvider.java +++ b/subprojects/java-compiler/src/main/java/com/itsaky/androidide/config/JavacConfigProvider.java @@ -14,48 +14,18 @@ public class JavacConfigProvider { /** * The latest source version that can be modeled. */ - private static SourceVersion latestSourceVersion; + private static SourceVersion latestSourceVersion = SourceVersion.RELEASE_17; /** * The latest source version supported by the compiler. */ - private static SourceVersion latestSupportedSourceVersion; + private static SourceVersion latestSupportedSourceVersion = latestSourceVersion; /** * Whether Java 9+ modules are enabled. */ private static boolean modulesEnabled = true; - - static { - try { - Field latest = tryGetRelease("RELEASE_17"); - if (latest == null) { - latest = tryGetRelease("RELEASE_11"); - } - - if (latest == null) { - latest = tryGetRelease("RELEASE_8"); - } - - if (latest == null) { - throw new IllegalStateException(); - } - - latestSourceVersion = (SourceVersion)latest.get(null); - latestSupportedSourceVersion = latestSourceVersion; - } catch (Throwable e) { - throw new RuntimeException(e); - } - } - - static Field tryGetRelease(String release) { - try { - return SourceVersion.class.getDeclaredField(release); - } catch (NoSuchFieldException e) { - return null; - } - } - + /** * Gets the androidide.java.home property if it has been specified * else fallbacks to the java.home property.