Package org.eclipse.jdt.internal.compiler.util

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


      }
    }
  }

  if (!isInconsistent) return null; // hierarchy is consistent so no collisions are possible
  SimpleSet copy = null;
  for (int i = 0; i < nextPosition; i++) {
    ReferenceBinding current = interfacesToVisit[i];
    if (current.isValidBinding()) {
      TypeBinding erasure = current.erasure();
      for (int j = i + 1; j < nextPosition; j++) {
        ReferenceBinding next = interfacesToVisit[j];
        if (next.isValidBinding() && next.erasure() == erasure) {
          if (copy == null)
            copy = new SimpleSet(nextPosition);
          copy.add(interfacesToVisit[i]);
          copy.add(interfacesToVisit[j]);
        }
      }
    }
  }
  return copy;
View Full Code Here


    }
    PackageDeclarationPattern pkgPattern = (PackageDeclarationPattern) searchPattern;
    boolean isWorkspaceScope = this.scope == JavaModelManager.getJavaModelManager().getWorkspaceScope();
    IPath[] scopeProjectsAndJars =  isWorkspaceScope ? null : this.scope.enclosingProjectsAndJars();
    int scopeLength = isWorkspaceScope ? 0 : scopeProjectsAndJars.length;
    SimpleSet packages = new SimpleSet();
    for (int i = 0, length = projects.length; i < length; i++) {
      IJavaProject javaProject = projects[i];
      if (this.progressMonitor != null) {
        if (this.progressMonitor.isCanceled()) throw new OperationCanceledException();
        this.progressWorked++;
        if ((this.progressWorked%this.progressStep)==0) this.progressMonitor.worked(this.progressStep);
      }
      // Verify that project belongs to the scope
      if (!isWorkspaceScope) {
        boolean found = false;
        for (int j=0; j<scopeLength; j++) {
          if (javaProject.getPath().equals(scopeProjectsAndJars[j])) {
            found = true;
            break;
          }
        }
        if (!found) continue;
      }
      // Get all project package fragment names
      this.nameLookup = ((JavaProject) projects[i]).newNameLookup(this.workingCopies);
      IPackageFragment[] packageFragments = this.nameLookup.findPackageFragments(new String(pkgPattern.pkgName), false, true);
      int pLength = packageFragments == null ? 0 : packageFragments.length;
      // Report matches avoiding duplicate names
      for (int p=0; p<pLength; p++) {
        IPackageFragment fragment = packageFragments[p];
        if (packages.addIfNotIncluded(fragment) == null) continue;
        if (encloses(fragment)) {
          IResource resource = fragment.getResource();
          if (resource == null) // case of a file in an external jar
            resource = javaProject.getProject();
          try {
View Full Code Here

        this.patternLocator.matchLevelAndReportImportRef(importRef, binding, this);
      } else {
        nodeSet.addMatch(node, this.patternLocator.resolveLevel(node));
      }
    }
    nodeSet.possibleMatchingNodesSet = new SimpleSet(3);
    if (BasicSearchEngine.VERBOSE) {
      int size = nodeSet.matchingNodes==null ? 0 : nodeSet.matchingNodes.elementSize;
      System.out.print("  - node set: accurate="+size); //$NON-NLS-1$
      size = nodeSet.possibleMatchingNodesSet==null ? 0 : nodeSet.possibleMatchingNodesSet.elementSize;
      System.out.println(", possible="+size); //$NON-NLS-1$
View Full Code Here

}
/*
* Removes unused indexes from disk.
*/
public void cleanUpIndexes() {
  SimpleSet knownPaths = new SimpleSet();
  IJavaSearchScope scope = BasicSearchEngine.createWorkspaceScope();
  PatternSearchJob job = new PatternSearchJob(null, SearchEngine.getDefaultSearchParticipant(), scope, null);
  Index[] selectedIndexes = job.getIndexes(null);
  for (int i = 0, l = selectedIndexes.length; i < l; i++) {
    String path = selectedIndexes[i].getIndexFile().getAbsolutePath();
    knownPaths.add(path);
  }

  if (this.indexStates != null) {
    Object[] keys = this.indexStates.keyTable;
    IPath[] locations = new IPath[this.indexStates.elementSize];
    int count = 0;
    for (int i = 0, l = keys.length; i < l; i++) {
      IPath key = (IPath) keys[i];
      if (key != null && !knownPaths.includes(key.toOSString()))
        locations[count++] = key;
    }
    if (count > 0)
      removeIndexesState(locations);
  }
View Full Code Here

  super.matchLevelAndReportImportRef(importRef, refBinding, locator);
}
protected void matchReportImportRef(ImportReference importRef, Binding binding, IJavaElement element, int accuracy, MatchLocator locator) throws CoreException {
  if (this.isDeclarationOfReferencedTypesPattern) {
    if ((element = findElement(element, accuracy)) != null) {
      SimpleSet knownTypes = ((DeclarationOfReferencedTypesPattern) this.pattern).knownTypes;
      while (binding instanceof ReferenceBinding) {
        ReferenceBinding typeBinding = (ReferenceBinding) binding;
        reportDeclaration(typeBinding, 1, locator, knownTypes);
        binding = typeBinding.enclosingType();
      }
View Full Code Here

                }
              }
              // 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

                  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

      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

  // 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

    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

TOP

Related Classes of org.eclipse.jdt.internal.compiler.util.SimpleSet

Copyright © 2018 www.massapicom. 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.