Skip to content

Commit 4a72119

Browse files
committed
Fix detection of minimum support version for javac
1 parent 6340a6d commit 4a72119

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/me/coley/recaf/compiler/JavacTargetVersion.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ public static JavacTargetVersion getMinJavacSupport() {
9696
try {
9797
Class<?> cls = Class.forName("com.sun.tools.javac.jvm.Target");
9898
Field min = cls.getDeclaredField("MIN");
99+
min.setAccessible(true);
99100
Object minTargetInstance = min.get(null);
100101
Field version = cls.getDeclaredField("majorVersion");
102+
version.setAccessible(true);
101103
return fromClassMajor(version.getInt(minTargetInstance));
102104
} catch (Exception ex) {
103-
Log.error("Failed to find javac minimum supported version, defaulting to Java 7");
105+
Log.error(ex, "Failed to find javac minimum supported version, defaulting to Java 7");
104106
}
105107
return V7;
106108
}

0 commit comments

Comments
 (0)