diff options
author | cushon <cushon@google.com> | 2017-10-05 23:34:51 +0200 |
---|---|---|
committer | Klaus Aehlig <aehlig@google.com> | 2017-10-06 19:48:29 +0200 |
commit | 2fc22de577f181a8490b13213efbe20cd3a2ae7b (patch) | |
tree | c825441c30885cd23502f1e12d02f9beff6f2bae | |
parent | 39347aa45e8eaf9a8ff307676567bc70a9a4ee49 (diff) |
Internal change
PiperOrigin-RevId: 171209823
-rw-r--r-- | src/java_tools/buildjar/java/com/google/devtools/build/java/bazel/BazelJavaCompiler.java | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/java/bazel/BazelJavaCompiler.java b/src/java_tools/buildjar/java/com/google/devtools/build/java/bazel/BazelJavaCompiler.java index cecf2e0a50..dd19c7c071 100644 --- a/src/java_tools/buildjar/java/com/google/devtools/build/java/bazel/BazelJavaCompiler.java +++ b/src/java_tools/buildjar/java/com/google/devtools/build/java/bazel/BazelJavaCompiler.java @@ -20,9 +20,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Writer; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; import java.nio.charset.Charset; import java.util.List; import java.util.Locale; @@ -63,28 +60,11 @@ public class BazelJavaCompiler { private static final Class<? extends JavaCompiler> JAVA_COMPILER_CLASS = getJavaCompilerClass(); - private static class LangtoolsClassLoader extends URLClassLoader { - - public LangtoolsClassLoader() throws MalformedURLException { - super( - new URL[] {getLangtoolsJar().toURI().toURL()}, - // We use the bootstrap classloader (null) as the parent classloader - // instead of the default "system" class loader; we intentionally do - // not consult the classpath. This way the class path is not - // polluted, we reduce the risk of having multiple langtools on the - // classpath, and langtools.jar is only opened if this method is - // called. And this will reduce problems for automated java - // dependency analysis, which other teams are trying to do. - null); - } - } - private static Class<? extends JavaCompiler> getJavaCompilerClass() { try { - ClassLoader cl = new LangtoolsClassLoader(); - return getJavaCompilerClass(cl); + return getJavaCompilerClass(BazelJavaCompiler.class.getClassLoader()); } catch (Exception e) { - throw new RuntimeException("Cannot get java compiler", e); + throw new LinkageError("Cannot get Java compiler", e); } } |