Examples of SimpleSet


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

public DeclarationOfReferencedTypesPattern(IJavaElement enclosingElement) {
  super(null, null, R_PATTERN_MATCH);

  this.enclosingElement = enclosingElement;
  this.knownTypes = new SimpleSet();
  ((InternalSearchPattern)this).mustResolve = true;
}
View Full Code Here

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

}
public void findIndexMatches(Index index, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope, IProgressMonitor progressMonitor) throws IOException {
  if (progressMonitor != null && progressMonitor.isCanceled()) throw new OperationCanceledException();

  this.resetQuery();
  SimpleSet intersectedNames = null;
  try {
    index.startQuery();
    do {
      SearchPattern pattern = ((InternalSearchPattern) this).currentPattern();
      EntryResult[] entries = ((InternalSearchPattern)pattern).queryIn(index);
      if (entries == null) return;

      SearchPattern decodedResult = pattern.getBlankPattern();
      SimpleSet newIntersectedNames = new SimpleSet(3);
      for (int i = 0, l = entries.length; i < l; i++) {
        if (progressMonitor != null && progressMonitor.isCanceled()) throw new OperationCanceledException();

        EntryResult entry = entries[i];
        decodedResult.decodeIndexKey(entry.getWord());
        if (pattern.matchesDecodedKey(decodedResult)) {
          String[] names = entry.getDocumentNames(index);
          if (intersectedNames != null) {
            for (int j = 0, n = names.length; j < n; j++)
              if (intersectedNames.includes(names[j]))
                newIntersectedNames.add(names[j]);
          } else {
            for (int j = 0, n = names.length; j < n; j++)
              newIntersectedNames.add(names[j]);
          }
        }
      }

      if (newIntersectedNames.elementSize == 0) return;
View Full Code Here

Examples of org.aspectj.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

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

    }
    superType = superType.superclass();
  }
  if (nextPosition == 0) return;

  SimpleSet skip = findSuperinterfaceCollisions(superclass, superInterfaces);
  for (int i = 0; i < nextPosition; i++) {
    superType = interfacesToVisit[i];
    if (superType.isValidBinding()) {
      if (skip != null && skip.includes(superType)) continue;
      if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
        int itsLength = itsInterfaces.length;
        if (nextPosition + itsLength >= interfacesToVisit.length)
          System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition);
        nextInterface : for (int a = 0; a < itsLength; a++) {
View Full Code Here

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

      receiverType = receiverType instanceof CaptureBinding ? receiverType : (ReferenceBinding) receiverType.erasure();
    nextSpecific : for (int i = 0; i < visibleSize; i++) {
      MethodBinding current = moreSpecific[i];
      if (current != null) {
        ReferenceBinding[] mostSpecificExceptions = null;
        SimpleSet possibleMethods = null;
        MethodBinding original = current.original();
        for (int j = 0; j < visibleSize; j++) {
          MethodBinding next = moreSpecific[j];
          if (next == null || i == j) continue;
          MethodBinding original2 = next.original();
          if (original.getOwningClass() == original2.getOwningClass()) // AspectJ Extension - was (original.declaringClass == original2.declaringClass)
            break nextSpecific; // duplicates thru substitution

          if (!original.isAbstract()) {
            if (original2.isAbstract())
              continue; // only compare current against other concrete methods
            // AspectJ Extension - move superType test inside - causes problems (pr233838)
            if (current.hasSubstitutedParameters() || original.typeVariables != Binding.NO_TYPE_VARIABLES) {
              TypeBinding superType = original.getOwningClass().findSuperTypeWithSameErasure(original2.getOwningClass().erasure()); // AspectJ Extension - was declaringClass, now getOwningClass()
              if (superType == null)
                continue nextSpecific; // current's declaringClass is not a subtype of next's declaringClass
              if (original2.declaringClass != superType) {
                // must find inherited method with the same substituted variables
                MethodBinding[] superMethods = ((ReferenceBinding) superType).getMethods(original2.selector);
                for (int m = 0, l = superMethods.length; m < l; m++) {
                  if (superMethods[m].original() == original2) {
                    original2 = superMethods[m];
                    break;
                  }
                }
              }
              if (!environment().methodVerifier().doesMethodOverride(original, original2))
                continue nextSpecific; // current does not override next
            }
          } else if (receiverType != null) { // should not be null if original isAbstract, but be safe
            TypeBinding superType = receiverType.findSuperTypeWithSameErasure(original.getOwningClass().erasure());// AspectJ Extension - was declaringClass, now getOwningClass()
            if (original.declaringClass == superType || !(superType instanceof ReferenceBinding)) {
              // keep original
            } else {
              // must find inherited method with the same substituted variables
              MethodBinding[] superMethods = ((ReferenceBinding) superType).getMethods(original.selector);
              for (int m = 0, l = superMethods.length; m < l; m++) {
                if (superMethods[m].original() == original) {
                  original = superMethods[m];
                  break;
                }
              }
            }
            superType = receiverType.findSuperTypeWithSameErasure(original2.getOwningClass().erasure());// AspectJ Extension - was declaringClass, now getOwningClass()
            if (original2.declaringClass == superType || !(superType instanceof ReferenceBinding)) {
              // keep original2
            } else {
              // must find inherited method with the same substituted variables
              MethodBinding[] superMethods = ((ReferenceBinding) superType).getMethods(original2.selector);
              for (int m = 0, l = superMethods.length; m < l; m++) {
                if (superMethods[m].original() == original2) {
                  original2 = superMethods[m];
                  break;
                }
              }
            }
            if (original.typeVariables != Binding.NO_TYPE_VARIABLES)
              original2 = original.computeSubstitutedMethod(original2, environment());
            if (original2 == null || !original.areParameterErasuresEqual(original2))
              continue nextSpecific; // current does not override next
            if (!original.returnType.isCompatibleWith(original2.returnType) &&
                !original.returnType.erasure().isCompatibleWith(original2.returnType.erasure())) {
              // 15.12.2
              continue nextSpecific; // choose original2 instead
            }
            if (original.thrownExceptions != original2.thrownExceptions) {
              if (mostSpecificExceptions == null)
                mostSpecificExceptions = original.thrownExceptions;
              if (possibleMethods == null)
                possibleMethods = new SimpleSet(3);
              int mostSpecificLength = mostSpecificExceptions.length;
              int original2Length = original2.thrownExceptions.length;
              SimpleSet temp = new SimpleSet(mostSpecificLength);
              nextException : for (int t = 0; t < mostSpecificLength; t++) {
                ReferenceBinding exception = mostSpecificExceptions[t];
                for (int s = 0; s < original2Length; s++) {
                  if (exception.isCompatibleWith(original2.thrownExceptions[s])) {
                    possibleMethods.add(current);
                    temp.add(exception);
                    continue nextException;
                  } else if (original2.thrownExceptions[s].isCompatibleWith(exception)) {
                    possibleMethods.add(next);
                    temp.add(original2.thrownExceptions[s]);
                    continue nextException;
                  }
                }
              }
              mostSpecificExceptions = temp.elementSize == 0 ? Binding.NO_EXCEPTIONS : new ReferenceBinding[temp.elementSize];
              temp.asArray(mostSpecificExceptions);
            }
          }
        }
        if (mostSpecificExceptions != null) {
          Object[] values = possibleMethods.values;
View Full Code Here

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

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

    }
    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

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

        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

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

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

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

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