Skip to content

Commit 1174c39

Browse files
committed
Remove CompilerClassLoader
1 parent f58253a commit 1174c39

File tree

2 files changed

+1
-144
lines changed

2 files changed

+1
-144
lines changed

sbt-bridge/src/xsbt/CompilerClassLoader.java

Lines changed: 0 additions & 122 deletions
This file was deleted.

sbt-bridge/src/xsbt/CompilerInterface.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,17 @@
66
import xsbti.AnalysisCallback;
77
import xsbti.Logger;
88
import xsbti.Reporter;
9-
import xsbti.Severity;
109
import xsbti.compile.*;
1110

1211
import java.io.File;
1312

14-
import dotty.tools.dotc.core.Contexts.ContextBase;
15-
import dotty.tools.dotc.Main;
16-
import dotty.tools.dotc.interfaces.*;
17-
18-
import java.lang.reflect.InvocationTargetException;
19-
import java.net.URLClassLoader;
20-
2113
/**
2214
* The new compiler interface is [[dotty.tools.xsbt.CompilerBridge]] that extends the new `xsbti.CompilerInterface2`.
2315
* This interface is kept for compatibility with Mill and the sbt 1.3.x series.
2416
*/
2517
public final class CompilerInterface {
2618
public CachedCompiler newCompiler(String[] options, Output output, Logger initialLog, Reporter initialDelegate) {
27-
// The classloader that sbt uses to load the compiler bridge is broken
28-
// (see CompilerClassLoader#fixBridgeLoader for details). To workaround
29-
// this we construct our own ClassLoader and then run the following code
30-
// with it:
31-
// new CachedCompilerImpl(options, output)
32-
33-
try {
34-
ClassLoader bridgeLoader = this.getClass().getClassLoader();
35-
ClassLoader fixedLoader = CompilerClassLoader.fixBridgeLoader(bridgeLoader);
36-
Class<?> cciClass = fixedLoader.loadClass("xsbt.CachedCompilerImpl");
37-
return (CachedCompiler) cciClass.getConstructors()[0].newInstance(options, output);
38-
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
39-
throw new RuntimeException(e);
40-
}
19+
return new CachedCompilerImpl(options, output);
4120
}
4221

4322
public void run(File[] sources, DependencyChanges changes, AnalysisCallback callback, Logger log,

0 commit comments

Comments
 (0)