Examples of SimpleSet


Examples of org.eclipse.jdt.internal.compiler.util.SimpleSet

                }
              }
              // https://bugs.eclipse.org/bugs/show_bug.cgi?id=335751
              if (compilerOptions().complianceLevel > ClassFileConstants.JDK1_6) {
                if (typeVariable.rank >= varSuperType.rank && varSuperType.declaringElement == typeVariable.declaringElement) {
                  SimpleSet set = new SimpleSet(typeParameters.length);
                  set.add(typeVariable);
                  ReferenceBinding superBinding = varSuperType;
                  while (superBinding instanceof TypeVariableBinding) {
                    if (set.includes(superBinding)) {
                      problemReporter().hierarchyCircularity(typeVariable, varSuperType, typeRef);
                      typeVariable.tagBits |= TagBits.HierarchyHasProblems;
                      break firstBound; // do not keep first bound
                    } else {
                      set.add(superBinding);
                      superBinding = ((TypeVariableBinding)superBinding).superclass;
                    }
                  }
                }
              }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.util.SimpleSet

                  if (mostSpecificExceptions == null) {
                    mostSpecificExceptions = current.thrownExceptions;
                  }
                  int mostSpecificLength = mostSpecificExceptions.length;
                  int nextLength = next.thrownExceptions.length;
                  SimpleSet temp = new SimpleSet(mostSpecificLength);
                  boolean changed = false;
                  nextException : for (int t = 0; t < mostSpecificLength; t++) {
                    ReferenceBinding exception = mostSpecificExceptions[t];
                    for (int s = 0; s < nextLength; s++) {
                      ReferenceBinding nextException = next.thrownExceptions[s];
                      if (exception.isCompatibleWith(nextException)) {
                        temp.add(exception);
                        continue nextException;
                      } else if (nextException.isCompatibleWith(exception)) {
                        temp.add(nextException);
                        changed = true;
                        continue nextException;
                      } else {
                        changed = true;
                      }
                    }
                  }
                  if (changed) {
                    mostSpecificExceptions = temp.elementSize == 0 ? Binding.NO_EXCEPTIONS : new ReferenceBinding[temp.elementSize];
                    temp.asArray(mostSpecificExceptions);
                  }
                }
              }
            }
          }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.util.SimpleSet

      for (int i = 0, l = this.javaBuilder.participants.length; i < l; i++) {
        if (this.javaBuilder.participants[i].isAnnotationProcessor()) {
          // initialize this set so the builder knows to gather CUs that define Annotation types
          // each Annotation processor participant is then asked to process these files AFTER
          // the compile loop. The normal dependency loop will then recompile all affected types
          this.filesWithAnnotations = new SimpleSet(1);
          break;
        }
      }
    }
  }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.util.SimpleSet

  // and if so should we pass the generated files from the each processor to the others to process?
  // and what happens if some participants do not expect to be called with only a few files, after seeing 'all' the files?
  for (int i = 0, l = this.javaBuilder.participants.length; i < l; i++)
    this.javaBuilder.participants[i].buildStarting(results, this instanceof BatchImageBuilder);

  SimpleSet uniqueFiles = null;
  CompilationParticipantResult[] toAdd = null;
  int added = 0;
  for (int i = results.length; --i >= 0;) {
    CompilationParticipantResult result = results[i];
    if (result == null) continue;

    IFile[] deletedGeneratedFiles = result.deletedFiles;
    if (deletedGeneratedFiles != null)
      deleteGeneratedFiles(deletedGeneratedFiles);

    IFile[] addedGeneratedFiles = result.addedFiles;
    if (addedGeneratedFiles != null) {
      for (int j = addedGeneratedFiles.length; --j >= 0;) {
        SourceFile sourceFile = findSourceFile(addedGeneratedFiles[j], true);
        if (sourceFile == null) continue;
        if (uniqueFiles == null) {
          uniqueFiles = new SimpleSet(unitsAboutToCompile.length + 3);
          for (int f = unitsAboutToCompile.length; --f >= 0;)
            uniqueFiles.add(unitsAboutToCompile[f]);
        }
        if (uniqueFiles.addIfNotIncluded(sourceFile) == sourceFile) {
          CompilationParticipantResult newResult = new CompilationParticipantResult(sourceFile);
          // is there enough room to add all the addedGeneratedFiles.length ?
          if (toAdd == null) {
            toAdd = new CompilationParticipantResult[addedGeneratedFiles.length];
          } else {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.util.SimpleSet

    String selector = new String(methodPattern.selector);
    int parameterCount = methodPattern.parameterCount;
    ITypeHierarchy superHierarchy = type.newSupertypeHierarchy(null);
    IType[] allTypes = superHierarchy.getAllSupertypes(type);
    int length = allTypes.length;
    SimpleSet focusSet = new SimpleSet(length+1);
    if (focusElement != null) focusSet.add(focusElement);
    for (int i=0; i<length; i++) {
      IMethod[] methods = allTypes[i].getMethods();
      int mLength = methods.length;
      for (int m=0; m<mLength; m++) {
        if (parameterCount == methods[m].getNumberOfParameters() && methods[m].getElementName().equals(selector)) {
          IPackageFragmentRoot root = (IPackageFragmentRoot) allTypes[i].getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
          IJavaElement element = root.isArchive() ? root : root.getParent();
          focusSet.add(element);
          if (superTypes != null) superTypes.add(allTypes[i]);
          break;
        }
      }
    }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.util.SimpleSet

*  Compute the list of paths which are keying index files.
*/
private void initializeIndexLocations() {
  IPath[] projectsAndJars = this.searchScope.enclosingProjectsAndJars();
  IndexManager manager = JavaModelManager.getIndexManager();
  SimpleSet locations = new SimpleSet();
  IJavaElement focus = MatchLocator.projectOrJarFocus(this.pattern);
  if (focus == null) {
    for (int i = 0; i < projectsAndJars.length; i++) {
      IPath path = projectsAndJars[i];
      Object target = JavaModel.getTarget(path, false/*don't check existence*/);
      if (target instanceof IFolder) // case of an external folder
        path = ((IFolder) target).getFullPath();
      locations.add(manager.computeIndexLocation(path));
    }
  } else {
    try {
      // See whether the state builder might be used to reduce the number of index locations
   
      // find the projects from projectsAndJars that see the focus then walk those projects looking for the jars from projectsAndJars
      int length = projectsAndJars.length;
      JavaProject[] projectsCanSeeFocus = new JavaProject[length];
      SimpleSet visitedProjects = new SimpleSet(length);
      int projectIndex = 0;
      SimpleSet externalLibsToCheck = new SimpleSet(length);
      ObjectVector superTypes = new ObjectVector();
      IJavaElement[] focuses = getFocusedElementsAndTypes(this.pattern, focus, superTypes);
      char[][][] focusQualifiedNames = null;
      boolean isAutoBuilding = ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding();
      if (isAutoBuilding && focus instanceof IJavaProject) {
        focusQualifiedNames = getQualifiedNames(superTypes);
      }
      IJavaModel model = JavaModelManager.getJavaModelManager().getJavaModel();
      for (int i = 0; i < length; i++) {
        IPath path = projectsAndJars[i];
        JavaProject project = (JavaProject) getJavaProject(path, model);
        if (project != null) {
          visitedProjects.add(project);
          if (canSeeFocus(focuses, project, focusQualifiedNames)) {
            locations.add(manager.computeIndexLocation(path));
            projectsCanSeeFocus[projectIndex++] = project;
          }
        } else {
          externalLibsToCheck.add(path);
        }
      }
      for (int i = 0; i < projectIndex && externalLibsToCheck.elementSize > 0; i++) {
        IClasspathEntry[] entries = projectsCanSeeFocus[i].getResolvedClasspath();
        for (int j = entries.length; --j >= 0;) {
          IClasspathEntry entry = entries[j];
          if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
            IPath path = entry.getPath();
            if (externalLibsToCheck.remove(path) != null) {
              Object target = JavaModel.getTarget(path, false/*don't check existence*/);
              if (target instanceof IFolder) // case of an external folder
                path = ((IFolder) target).getFullPath();
              locations.add(manager.computeIndexLocation(path));
            }
          }
        }
      }
      // jar files can be included in the search scope without including one of the projects that references them, so scan all projects that have not been visited
      if (externalLibsToCheck.elementSize > 0) {
        IJavaProject[] allProjects = model.getJavaProjects();
        for (int i = 0, l = allProjects.length; i < l && externalLibsToCheck.elementSize > 0; i++) {
          JavaProject project = (JavaProject) allProjects[i];
          if (!visitedProjects.includes(project)) {
            IClasspathEntry[] entries = project.getResolvedClasspath();
            for (int j = entries.length; --j >= 0;) {
              IClasspathEntry entry = entries[j];
              if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
                IPath path = entry.getPath();
                if (externalLibsToCheck.remove(path) != null) {
                  Object target = JavaModel.getTarget(path, false/*don't check existence*/);
                  if (target instanceof IFolder) // case of an external folder
                    path = ((IFolder) target).getFullPath();
                  locations.add(manager.computeIndexLocation(path));
                }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.util.SimpleSet

  this.categoryEnds = null;
}
SimpleSet addDocumentNames(String substring, MemoryIndex memoryIndex) throws IOException {
  // must skip over documents which have been added/changed/deleted in the memory index
  String[] docNames = readAllDocumentNames();
  SimpleSet results = new SimpleSet(docNames.length);
  if (substring == null) {
    if (memoryIndex == null) {
      for (int i = 0, l = docNames.length; i < l; i++)
        results.add(docNames[i]);
    } else {
      SimpleLookupTable docsToRefs = memoryIndex.docsToReferences;
      for (int i = 0, l = docNames.length; i < l; i++) {
        String docName = docNames[i];
        if (!docsToRefs.containsKey(docName))
          results.add(docName);
      }
    }
  } else {
    if (memoryIndex == null) {
      for (int i = 0, l = docNames.length; i < l; i++)
        if (docNames[i].startsWith(substring, 0))
          results.add(docNames[i]);
    } else {
      SimpleLookupTable docsToRefs = memoryIndex.docsToReferences;
      for (int i = 0, l = docNames.length; i < l; i++) {
        String docName = docNames[i];
        if (docName.startsWith(substring, 0) && !docsToRefs.containsKey(docName))
          results.add(docName);
      }
    }
  }
  return results;
}
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.util.SimpleSet

}
/**
* Returns the document names that contain the given substring, if null then returns all of them.
*/
public String[] queryDocumentNames(String substring) throws IOException {
  SimpleSet results;
  if (this.memoryIndex.hasChanged()) {
    results = this.diskIndex.addDocumentNames(substring, this.memoryIndex);
    this.memoryIndex.addDocumentNames(substring, results);
  } else {
    results = this.diskIndex.addDocumentNames(substring, null);
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.util.SimpleSet

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) {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.util.SimpleSet

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) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.