< prev index next > src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
Print this page
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;
import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
import com.sun.tools.javac.file.RelativePath.RelativeFile;
+ import com.sun.tools.javac.main.JavaCompiler;
+ import com.sun.tools.javac.main.JavaCompiler.CodeReflectionSupport;
import com.sun.tools.javac.main.Option;
import com.sun.tools.javac.resources.CompilerProperties.Errors;
import com.sun.tools.javac.util.Assert;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Context.Factory;
getClass().getModule().addUses(service);
if (location.isModuleOrientedLocation()) {
Collection<Path> paths = locations.getLocation(location);
ModuleFinder finder = ModuleFinder.of(paths.toArray(new Path[paths.size()]));
ModuleLayer bootLayer = ModuleLayer.boot();
- Configuration cf = bootLayer.configuration().resolveAndBind(ModuleFinder.of(), finder, Collections.emptySet());
- ModuleLayer layer = bootLayer.defineModulesWithOneLoader(cf, ClassLoader.getSystemClassLoader());
+ ModuleLayer augmentedModuleLayer;
+ ClassLoader parentCL;
+ if (CodeReflectionSupport.CODE_LAYER != null) {
+ // create a layer whose parent is Babylon's code layer
+ augmentedModuleLayer = CodeReflectionSupport.CODE_LAYER;
+ parentCL = CodeReflectionSupport.CODE_LAYER.findLoader("jdk.incubator.code");
+ } else {
+ augmentedModuleLayer = bootLayer;
+ parentCL = ClassLoader.getSystemClassLoader();
+ }
+ Configuration cf = augmentedModuleLayer.configuration()
+ .resolveAndBind(ModuleFinder.of(), finder, Collections.emptySet());
+ ModuleLayer layer = augmentedModuleLayer.defineModulesWithOneLoader(cf, parentCL);
return ServiceLoader.load(layer, service);
} else {
return ServiceLoader.load(service, getClassLoader(location));
}
}
< prev index next >