public void cleanup() { for (int i = 0, length = this.locations.length; i < length; i++) { this.locations[i].cleanup(); } }
private void printLocations(ClasspathLocation[] newLocations, ClasspathLocation[] oldLocations) { System.out.println("JavaBuilder: New locations:"); //$NON-NLS-1$ for (int i = 0, length = newLocations.length; i < length; i++) System.out.println(" " + newLocations[i].debugPathString()); //$NON-NLS-1$ System.out.println("JavaBuilder: Old locations:"); //$NON-NLS-1$ for (int i = 0, length = oldLocations.length; i < length; i++) System.out.println(" " + oldLocations[i].debugPathString()); //$NON-NLS-1$ }
public NameEnvironmentAnswer findClass(char[] typeName, String qualifiedPackageName, String moduleName, String qualifiedBinaryFileName, boolean asBinaryOnly) { String fileName = new String(typeName); return findClass(fileName, qualifiedPackageName, moduleName, qualifiedBinaryFileName, asBinaryOnly); } public void setModule (IModule mod) {
public char[][] getModulesDeclaringPackage(String qualifiedPackageName, String moduleName) { return singletonModuleNameIf(isPackage(qualifiedPackageName, moduleName)); } public boolean hasModule() { return getModule() != null; }
if ((folderName = in.readUTF()).length() > 0) outputFolder = project.getFolder(folderName); ClasspathMultiDirectory md = (ClasspathMultiDirectory) ClasspathLocation.forSourceFolder(sourceFolder, outputFolder, readNames(in), readNames(in), in.readBoolean()); if (in.readBoolean()) md.hasIndependentOutputFolder = true; ? (IContainer) root.getProject(path.toString()) : (IContainer) root.getFolder(path); newState.binaryLocations[i] = ClasspathLocation.forBinaryFolder(outputFolder, in.readBoolean(), readRestriction(in), new Path(in.readUTF()), in.readBoolean()); break; case EXTERNAL_JAR : String jarPath = in.readUTF(); newState.binaryLocations[i] = ClasspathLocation.forLibrary(jarPath, in.readLong(), readRestriction(in), new Path(in.readUTF()), Util.isJrt(jarPath) ? false : in.readBoolean()); break; case INTERNAL_JAR : newState.binaryLocations[i] = ClasspathLocation.forLibrary(root.getFile(new Path(in.readUTF())), readRestriction(in), new Path(in.readUTF()), in.readBoolean());
IPath p = bLocation.getProjectRelativePath(); if (p != null) { IResourceDelta binaryDelta = delta.findMember(p); if (bLocation.isOutputFolder()) structurallyChangedTypes = this.newState.getStructurallyChangedTypes(this.javaBuilder.getLastState(prereqProject)); for (int j = 0, m = children.length; j < m; j++)
if ((folderName = in.readUTF()).length() > 0) outputFolder = project.getFolder(folderName); ClasspathMultiDirectory md = (ClasspathMultiDirectory) ClasspathLocation.forSourceFolder(sourceFolder, outputFolder, readNames(in), readNames(in), in.readBoolean()); if (in.readBoolean()) md.hasIndependentOutputFolder = true; ? (IContainer) root.getProject(path.toString()) : (IContainer) root.getFolder(path); newState.binaryLocations[i] = ClasspathLocation.forBinaryFolder(outputFolder, in.readBoolean(), readRestriction(in), new Path(in.readUTF()), in.readBoolean()); break; String jarPath = in.readUTF(); if (Util.isJrt(jarPath)) { newState.binaryLocations[i] = ClasspathLocation.forJrtSystem(jarPath, readRestriction(in), new Path(in.readUTF()), in.readUTF()); } else { newState.binaryLocations[i] = ClasspathLocation.forLibrary(jarPath, in.readLong(), readRestriction(in), new Path(in.readUTF()), in.readBoolean(), in.readUTF()); newState.binaryLocations[i] = ClasspathLocation.forLibrary(root.getFile(new Path(in.readUTF())), readRestriction(in), new Path(in.readUTF()), in.readBoolean(), in.readUTF()); break; if ((folderName = in.readUTF()).length() > 0) outputFolder = project.getFolder(folderName); ClasspathMultiDirectory md = (ClasspathMultiDirectory) ClasspathLocation.forSourceFolder(sourceFolder, outputFolder, readNames(in), readNames(in), in.readBoolean()); if (in.readBoolean()) md.hasIndependentOutputFolder = true;
public boolean isPackage(String qualifiedPackageName) { // NOTE: the output folders are added at the beginning of the binaryLocations for (int i = 0, l = this.binaryLocations.length; i < l; i++) if (this.binaryLocations[i].isPackage(qualifiedPackageName)) return true; return false; }
new ClasspathJrt(path.toOSString(), rawClasspathEntry.getAccessRuleSet(), ClasspathEntry.getExternalAnnotationPath(rawClasspathEntry, project.getProject(), true), compliance) : ClasspathLocation.forLibrary(manager.getZipFile(path), rawClasspathEntry.getAccessRuleSet(), ClasspathEntry.getExternalAnnotationPath(rawClasspathEntry, ((IJavaProject) root.getParent()).getProject(), true), } else { ClasspathEntry rawClasspathEntry = (ClasspathEntry) root.getRawClasspathEntry(); cp = ClasspathLocation.forBinaryFolder((IContainer) target, false, rawClasspathEntry.getAccessRuleSet(), ClasspathEntry.getExternalAnnotationPath(rawClasspathEntry, ((IJavaProject)root.getParent()).getProject(), true), rawClasspathEntry.isModular());
public static ClasspathLocation forLibrary(String libraryPathname, AccessRuleSet accessRuleSet, IPath annotationsPath, boolean autoModule, String compliance) { return forLibrary(libraryPathname, 0, accessRuleSet, annotationsPath, autoModule, compliance); }
private boolean hasStructuralDelta() { // handle case when currentProject has only .class file folders and/or jar files... no source/output folders IResourceDelta delta = getDelta(this.currentProject); if (delta != null && delta.getKind() != IResourceDelta.NO_CHANGE) { ClasspathLocation[] classFoldersAndJars = (ClasspathLocation[]) this.binaryLocationsPerProject.get(this.currentProject); if (classFoldersAndJars != null) { for (int i = 0, l = classFoldersAndJars.length; i < l; i++) { ClasspathLocation classFolderOrJar = classFoldersAndJars[i]; // either a .class file folder or a zip/jar file if (classFolderOrJar != null) { IPath p = classFolderOrJar.getProjectRelativePath(); if (p != null) { IResourceDelta binaryDelta = delta.findMember(p); if (binaryDelta != null && binaryDelta.getKind() != IResourceDelta.NO_CHANGE) return true; } } } } } return false; }
void setNames(String[] typeNames, SourceFile[] additionalFiles) { // convert the initial typeNames to a set if (typeNames == null) { this.initialTypeNames = null; } else { this.initialTypeNames = new SimpleSet(typeNames.length); for (int i = 0, l = typeNames.length; i < l; i++) this.initialTypeNames.add(typeNames[i]); } // map the additional source files by qualified type name if (additionalFiles == null) { this.additionalUnits = null; } else { this.additionalUnits = new SimpleLookupTable(additionalFiles.length); for (int i = 0, l = additionalFiles.length; i < l; i++) { SourceFile additionalUnit = additionalFiles[i]; if (additionalUnit != null) this.additionalUnits.put(additionalUnit.initialTypeName, additionalFiles[i]); } } for (int i = 0, l = this.sourceLocations.length; i < l; i++) this.sourceLocations[i].reset(); for (int i = 0, l = this.binaryLocations.length; i < l; i++) this.binaryLocations[i].reset(); } }
boolean canSkip = true; for (int j = 0, m = classFoldersAndJars.length; j < m; j++) { if (classFoldersAndJars[j].isOutputFolder())
cpLocations[index++] = new ClasspathSourceDirectory((IContainer)target, root.fullExclusionPatternChars(), root.fullInclusionPatternChars()); } else { cpLocations[index++] = ClasspathLocation.forBinaryFolder((IContainer) target, false, ((ClasspathEntry) root.getRawClasspathEntry()).getAccessRuleSet());
if (l != null) { for (ClasspathLocation cp : l) { if (cp.isPackage(qualifiedPackageName, moduleNameString)) return new char[][] { moduleName }; for (ClasspathLocation location : this.locationSet) { if (strategy.matches(location, ClasspathLocation::hasModule) ) { if (location.isPackage(qualifiedPackageName, null)) { char[][] mNames = location.getModulesDeclaringPackage(qualifiedPackageName, null); if (mNames == null || mNames.length == 0) continue; moduleNames = CharOperation.arrayConcat(moduleNames, mNames);
if ((folderName = in.readUTF()).length() > 0) outputFolder = project.getFolder(folderName); ClasspathMultiDirectory md = (ClasspathMultiDirectory) ClasspathLocation.forSourceFolder(sourceFolder, outputFolder, readNames(in), readNames(in), in.readBoolean()); if (in.readBoolean()) md.hasIndependentOutputFolder = true; ? (IContainer) root.getProject(path.toString()) : (IContainer) root.getFolder(path); newState.binaryLocations[i] = ClasspathLocation.forBinaryFolder(outputFolder, in.readBoolean(), readRestriction(in), new Path(in.readUTF())); break; case EXTERNAL_JAR : newState.binaryLocations[i] = ClasspathLocation.forLibrary(in.readUTF(), in.readLong(), readRestriction(in), new Path(in.readUTF())); break; case INTERNAL_JAR : newState.binaryLocations[i] = ClasspathLocation.forLibrary(root.getFile(new Path(in.readUTF())), readRestriction(in), new Path(in.readUTF()));
IPath p = bLocation.getProjectRelativePath(); if (p != null) { IResourceDelta binaryDelta = delta.findMember(p); if (bLocation.isOutputFolder()) structurallyChangedTypes = this.newState.getStructurallyChangedTypes(this.javaBuilder.getLastState(prereqProject)); for (int j = 0, m = children.length; j < m; j++)
ClasspathLocation bLocation = ClasspathLocation.forBinaryFolder(outputFolder, true, entry.getAccessRuleSet(), externalAnnotationPath, isOnModulePath); bLocations.add(bLocation); sLocationsForTest.add(bLocation); ClasspathLocation sourceLocation = ClasspathLocation.forSourceFolder( (IContainer) target, outputFolder, if (binaryFolder.exists() && !seen.contains(binaryFolder)) { seen.add(binaryFolder); ClasspathLocation bLocation = ClasspathLocation.forBinaryFolder(binaryFolder, true, entry.getAccessRuleSet(), externalAnnotationPath, isOnModulePath); bLocations.add(bLocation); projectLocations.add(bLocation); ? null : entry.getAccessRuleSet(); bLocation = ClasspathLocation.forLibrary((IFile) resource, accessRuleSet, externalAnnotationPath, isOnModulePath, compliance); } else if (resource instanceof IContainer) { AccessRuleSet accessRuleSet = ? null : entry.getAccessRuleSet(); bLocation = ClasspathLocation.forBinaryFolder((IContainer) target, false, accessRuleSet, externalAnnotationPath, isOnModulePath); // is library folder not output folder String libPath = path.toOSString(); if (Util.isJrt(libPath)) { bLocation = ClasspathLocation.forJrtSystem(path.toOSString(), accessRuleSet, externalAnnotationPath, release); } else { bLocation = ClasspathLocation.forLibrary(path.toOSString(), accessRuleSet, externalAnnotationPath, isOnModulePath, compliance);
public boolean isPackage(String qualifiedPackageName) { for (int i = 0, length = this.locations.length; i < length; i++) if (this.locations[i].isPackage(qualifiedPackageName)) return true; return false; }
static ClasspathLocation forLibrary(String libraryPathname, AccessRuleSet accessRuleSet) { return forLibrary(libraryPathname, 0, accessRuleSet); }