Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
Remove usage of 'com.itsaky.androidide.utils.Environment' class
Browse files Browse the repository at this point in the history
  • Loading branch information
itsaky committed Jul 8, 2022
1 parent 89f67a7 commit 9a032bc
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/jdk.compiler/share/classes/jdk/internal/jrtfs/SystemImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import jdk.internal.jimage.ImageReader;
import jdk.internal.jimage.ImageReader.Node;

import com.itsaky.androidide.config.JavacConfigProvider;

/**
* @implNote This class needs to maintain JDK 8 source compatibility.
*
Expand Down Expand Up @@ -87,19 +89,7 @@ public Boolean run() {
* otherwise the JDK home is located relative to jrt-fs.jar.
*/
private static String findHome() {
// ANDROIDIDE-CHANGED: Do not bother to find JAVA_HOME
// Simply return the compiler module path using Environment.COMPILER_MODULE.
return getCompilerModulePath();
}

private static String getCompilerModulePath() {
final String className = "com.itsaky.androidide.utils.Environment";
try {
final Class<?> klass = Class.forName(className);
final Field field = klass.getDeclaredField("COMPILER_MODULE");
return ((java.io.File) field.get(null)).getAbsolutePath();
} catch (Throwable error) {
throw new IllegalStateException("Unable to get compiler module path from class: ".concat(className));
}
// AndroidIDE changed: Allow overriding java home.
return JavacConfigProvider.getJavaHome();
}
}

0 comments on commit 9a032bc

Please sign in to comment.