@Override public NameEnvironmentAnswer findClass(char[] typeName, String qualifiedPackageName, String moduleName, String qualifiedBinaryFileName) { return findClass(typeName, qualifiedPackageName, moduleName, qualifiedBinaryFileName, false); } @Override
@Override public boolean servesModule(char[] moduleName) { return getModule(moduleName) != null; } }
@Override public void initialize() throws IOException { loadModules(); } // public void acceptModule(IModuleDeclaration mod) {
@Override public NameEnvironmentAnswer findClass(char[] typeName, String qualifiedPackageName, String moduleName, String qualifiedBinaryFileName, boolean asBinaryOnly) { if (!isPackage(qualifiedPackageName, moduleName)) return null; // most common case if (answerModuleName == null && moduleName != null) answerModuleName = moduleName.toCharArray(); return new NameEnvironmentAnswer(reader, fetchAccessRestriction(qualifiedBinaryFileName), answerModuleName);
public static Classpath getJrtClasspath(String jdkHome, String encoding, AccessRuleSet accessRuleSet, Map<String, String> options) { return new ClasspathJrt(new File(convertPathSeparators(jdkHome)), true, accessRuleSet, null); } public static Classpath getOlderSystemRelease(String jdkHome, String release, AccessRuleSet accessRuleSet) {
@Override void acceptModule(ClassFileReader reader) { // Modules below level 8 are not dealt with here. Leave it to ClasspathJrt if (this.jdklevel <= ClassFileConstants.JDK1_8) { super.acceptModule(reader); return; } if (reader != null) { IModule moduleDecl = reader.getModuleDeclaration(); if (moduleDecl != null) { Map<String, IModule> cache = ModulesCache.get(this.modulePath); if (cache == null) { ModulesCache.put(this.modulePath, cache = new HashMap<String,IModule>()); } cache.put(String.valueOf(moduleDecl.name()), moduleDecl); } } } protected void addToPackageCache(String packageName, boolean endsWithSep) {
public char[] normalizedPath() { if (this.normalizedPath == null) { String path2 = this.getPath(); char[] rawName = path2.toCharArray(); if (File.separatorChar == '\\') { CharOperation.replace(rawName, '\\', '/'); } this.normalizedPath = CharOperation.subarray(rawName, 0, CharOperation.lastIndexOf('.', rawName)); } return this.normalizedPath; } public String getPath() {
@Override public Collection<String> getModuleNames(Collection<String> limitModule, Function<String, IModule> getModule) { Map<String, IModule> cache = ModulesCache.get(this.file.getPath()); return selectModules(cache.keySet(), limitModule, getModule); } @Override
public char[][][] findTypeNames(final String qualifiedPackageName, final String moduleName) { if (!isPackage(qualifiedPackageName, moduleName)) return null; // most common case final char[] packageArray = qualifiedPackageName.toCharArray();
@Override public void initialize() throws IOException { if (this.compliance == null) { return; } this.releaseInHex = Integer.toHexString(Integer.parseInt(this.compliance)).toUpperCase(); Path filePath = this.jdkHome.toPath().resolve("lib").resolve("ct.sym"); //$NON-NLS-1$ //$NON-NLS-2$ URI t = filePath.toUri(); if (!Files.exists(filePath)) { return; } URI uri = URI.create("jar:file:" + t.getRawPath()); //$NON-NLS-1$ try { this.fs = FileSystems.getFileSystem(uri); } catch(FileSystemNotFoundException fne) { // Ignore and move on } if (this.fs == null) { HashMap<String, ?> env = new HashMap<>(); this.fs = FileSystems.newFileSystem(uri, env); } this.releasePath = this.fs.getPath("/"); //$NON-NLS-1$ if (!Files.exists(this.fs.getPath(this.releaseInHex))) { throw new IllegalArgumentException("release " + this.compliance + " is not found in the system"); //$NON-NLS-1$//$NON-NLS-2$ } super.initialize(); } @Override
public NameEnvironmentAnswer findClass(char[] typeName, String qualifiedPackageName, String moduleName, String qualifiedBinaryFileName, boolean asBinaryOnly) { if (!isPackage(qualifiedPackageName, moduleName)) return null; // most common case if (answerModuleName == null && moduleName != null) answerModuleName = moduleName.toCharArray(); return new NameEnvironmentAnswer(reader, fetchAccessRestriction(qualifiedBinaryFileName), answerModuleName);
public static Classpath getJrtClasspath(String jdkHome, String encoding, AccessRuleSet accessRuleSet, Map<String, String> options) { return new ClasspathJrt(new File(convertPathSeparators(jdkHome)), true, accessRuleSet, null); } public static Classpath getOlderSystemRelease(String jdkHome, String release, AccessRuleSet accessRuleSet) {
void acceptModule(byte[] content) { if (content == null) return; ClassFileReader reader = null; try { reader = new ClassFileReader(content, IModule.MODULE_INFO_CLASS.toCharArray()); } catch (ClassFormatException e) { e.printStackTrace(); } if (reader != null) { acceptModule(reader); } }
@Override public char[] normalizedPath() { if (this.normalizedPath == null) { String path2 = this.getPath(); char[] rawName = path2.toCharArray(); if (File.separatorChar == '\\') { CharOperation.replace(rawName, '\\', '/'); } this.normalizedPath = CharOperation.subarray(rawName, 0, CharOperation.lastIndexOf('.', rawName)); } return this.normalizedPath; } @Override
@Override public Collection<String> getModuleNames(Collection<String> limitModule, Function<String, IModule> getModule) { Map<String, IModule> cache = ModulesCache.get(this.file.getPath()); return selectModules(cache.keySet(), limitModule, getModule); } protected <T> List<String> allModules(Iterable<T> allSystemModules, Function<T,String> getModuleName, Function<T,IModule> getModule) {
@Override public char[][][] findTypeNames(final String qualifiedPackageName, final String moduleName) { if (!isPackage(qualifiedPackageName, moduleName)) return null; // most common case final char[] packageArray = qualifiedPackageName.toCharArray();
result = new ClasspathJrt(file, true, accessRuleSet, null); try { result.initialize();
public void initialize() throws IOException { loadModules(); } // public void acceptModule(IModuleDeclaration mod) {
void acceptModule(byte[] content) { if (content == null) return; ClassFileReader reader = null; try { reader = new ClassFileReader(content, IModule.MODULE_INFO_CLASS.toCharArray()); } catch (ClassFormatException e) { e.printStackTrace(); } if (reader != null) { acceptModule(reader); } }
public NameEnvironmentAnswer findClass(char[] typeName, String qualifiedPackageName, String moduleName, String qualifiedBinaryFileName) { return findClass(typeName, qualifiedPackageName, moduleName, qualifiedBinaryFileName, false); } public NameEnvironmentAnswer findClass(char[] typeName, String qualifiedPackageName, String moduleName, String qualifiedBinaryFileName, boolean asBinaryOnly) {