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

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


SimpleLookupTable storedAnnotations(boolean forceInitialize) {
  if (forceInitialize && this.storedAnnotations == null && this.scope != null) { // scope null when no annotation cached, and type got processed fully (159631)
    this.scope.referenceCompilationUnit().compilationResult.hasAnnotations = true;
    if (!this.scope.environment().globalOptions.storeAnnotations)
      return null; // not supported during this compile
    this.storedAnnotations = new SimpleLookupTable(3);
  }
  return this.storedAnnotations;
}
View Full Code Here


  int copiesLength = copies.size();
  this.workingCopies = new org.eclipse.jdt.core.ICompilationUnit[copiesLength];
  copies.toArray(this.workingCopies);

  JavaModelManager manager = JavaModelManager.getJavaModelManager();
  this.bindings = new SimpleLookupTable();
  try {
    // optimize access to zip files during search operation
    manager.cacheZipFiles(this);

    // initialize handle factory (used as a cache of handles so as to optimize space)
View Full Code Here

    try {
      monitor.enterRead(); // ask permission to read

      String[] paths = index.queryDocumentNames(""); // all file names //$NON-NLS-1$
      int max = paths == null ? 0 : paths.length;
      final SimpleLookupTable indexedFileNames = new SimpleLookupTable(max==0 ? 33 : max+11);
      final String OK = "OK"; //$NON-NLS-1$
      final String DELETED = "DELETED"; //$NON-NLS-1$
      if (paths == null) {
        this.folder.accept(new IResourceProxyVisitor() {
          public boolean visit(IResourceProxy proxy) {
            if (IndexBinaryFolder.this.isCancelled) return false;
            if (proxy.getType() == IResource.FILE) {
              if (org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(proxy.getName())) {
                IFile file = (IFile) proxy.requestResource();
                String containerRelativePath = Util.relativePath(file.getFullPath(), IndexBinaryFolder.this.containerPath.segmentCount());
                indexedFileNames.put(containerRelativePath, file);
              }
              return false;
            }
            return true;
          }
        }, IResource.NONE);
      } else {
        for (int i = 0; i < max; i++) {
          indexedFileNames.put(paths[i], DELETED);
        }
        final long indexLastModified = index.getIndexFile().lastModified();
        this.folder.accept(
          new IResourceProxyVisitor() {
            public boolean visit(IResourceProxy proxy) throws CoreException {
              if (IndexBinaryFolder.this.isCancelled) return false;
              if (proxy.getType() == IResource.FILE) {
                if (org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(proxy.getName())) {
                  IFile file = (IFile) proxy.requestResource();
                  URI location = file.getLocationURI();
                  if (location != null) {
                    String containerRelativePath = Util.relativePath(file.getFullPath(), IndexBinaryFolder.this.containerPath.segmentCount());
                    indexedFileNames.put(containerRelativePath,
                      indexedFileNames.get(containerRelativePath) == null
                          || indexLastModified <
                          EFS.getStore(location).fetchInfo().getLastModified()
                        ? (Object) file
                        : (Object) OK);
                  }
View Full Code Here

}
/*
* Creates an empty index at the given location, for the given container path, if none exist.
*/
public synchronized void ensureIndexExists(IPath indexLocation, IPath containerPath) {
  SimpleLookupTable states = getIndexStates();
  Object state = states.get(indexLocation);
  if (state == null) {
    updateIndexState(indexLocation, REBUILDING_STATE);
    getIndex(containerPath, indexLocation, true, true);
  }
}
View Full Code Here

  return null; // abort the job since the index has been removed from the REBUILDING_STATE
}
private SimpleLookupTable getIndexStates() {
  if (this.indexStates != null) return this.indexStates;

  this.indexStates = new SimpleLookupTable();
  IPath indexesDirectoryPath = getJavaPluginWorkingLocation();
  char[][] savedNames = readIndexState(indexesDirectoryPath.toOSString());
  if (savedNames != null) {
    for (int i = 1, l = savedNames.length; i < l; i++) { // first name is saved signature, see readIndexState()
      char[] savedName = savedNames[i];
View Full Code Here

* Flush current state
*/
public synchronized void reset() {
  super.reset();
  if (this.indexes != null) {
    this.indexes = new SimpleLookupTable();
    this.indexStates = null;
  }
  this.indexLocations = new SimpleLookupTable();
  this.javaPluginLocation = null;
}
View Full Code Here

      Util.verbose("Failed to read saved index file names"); //$NON-NLS-1$
  }
  return null;
}
private void readParticipantsIndexNamesFile() {
  SimpleLookupTable containers = new SimpleLookupTable(3);
  try {
    char[] participantIndexNames = org.eclipse.jdt.internal.compiler.util.Util.getFileCharContent(this.participantIndexNamesFile, null);
    if (participantIndexNames.length > 0) {
      char[][] names = CharOperation.splitOn('\n', participantIndexNames);
      if (names.length >= 3) {
        // First line is DiskIndex signature  (see writeParticipantsIndexNamesFile())
        if (DiskIndex.SIGNATURE.equals(new String(names[0]))) {         
          for (int i = 1, l = names.length-1 ; i < l ; i+=2) {
            containers.put(new Path(new String(names[i])), new Path(new String(names[i+1])));
          }
        }       
      }
    } 
  } catch (IOException ignored) {
View Full Code Here

      int methodTypeVariablesArity = methodTypeVariables.length;
         
      MethodBinding staticFactory = new MethodBinding(method.modifiers | ClassFileConstants.AccStatic, TypeConstants.SYNTHETIC_STATIC_FACTORY,
                                    null, null, null, method.declaringClass);
      staticFactory.typeVariables = new TypeVariableBinding[classTypeVariablesArity + methodTypeVariablesArity];
      final SimpleLookupTable map = new SimpleLookupTable(classTypeVariablesArity + methodTypeVariablesArity);
      // Rename each type variable T of the type to T'
      final LookupEnvironment environment = environment();
      for (int j = 0; j < classTypeVariablesArity; j++) {
        map.put(classTypeVariables[j], staticFactory.typeVariables[j] = new TypeVariableBinding(CharOperation.concat(classTypeVariables[j].sourceName, "'".toCharArray()), //$NON-NLS-1$
                                      staticFactory, j, environment));
      }
      // Rename each type variable U of method U to U''.
      for (int j = classTypeVariablesArity, max = classTypeVariablesArity + methodTypeVariablesArity; j < max; j++) {
        map.put(methodTypeVariables[j - classTypeVariablesArity],
            (staticFactory.typeVariables[j] = new TypeVariableBinding(CharOperation.concat(methodTypeVariables[j - classTypeVariablesArity].sourceName, "''".toCharArray()), //$NON-NLS-1$
                                      staticFactory, j, environment)));
      }
      ReferenceBinding enclosingType = originalEnclosingType;
      while (enclosingType != null) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=345968
        if (enclosingType.kind() == Binding.PARAMETERIZED_TYPE) {
          final ParameterizedTypeBinding parameterizedType = (ParameterizedTypeBinding) enclosingType;
          final ReferenceBinding genericType = parameterizedType.genericType();
          TypeVariableBinding[] enclosingClassTypeVariables = genericType.typeVariables();
          int enclosingClassTypeVariablesArity = enclosingClassTypeVariables.length;
          for (int j = 0; j < enclosingClassTypeVariablesArity; j++) {
            map.put(enclosingClassTypeVariables[j], parameterizedType.arguments[j]);
          }
        }
        enclosingType = enclosingType.enclosingType();
      }
      final Scope scope = this;
      Substitution substitution = new Substitution() {
          public LookupEnvironment environment() {
            return scope.environment();
          }
          public boolean isRawSubstitution() {
            return false;
          }
          public TypeBinding substitute(TypeVariableBinding typeVariable) {
            TypeBinding retVal = (TypeBinding) map.get(typeVariable);
            return retVal != null ? retVal : typeVariable;
          }
        };

      // initialize new variable bounds
      for (int j = 0, max = classTypeVariablesArity + methodTypeVariablesArity; j < max; j++) {
        TypeVariableBinding originalVariable = j < classTypeVariablesArity ? classTypeVariables[j] : methodTypeVariables[j - classTypeVariablesArity];
        TypeBinding substitutedType = (TypeBinding) map.get(originalVariable);
        if (substitutedType instanceof TypeVariableBinding) {
          TypeVariableBinding substitutedVariable = (TypeVariableBinding) substitutedType;
          TypeBinding substitutedSuperclass = Scope.substitute(substitution, originalVariable.superclass);
          ReferenceBinding[] substitutedInterfaces = Scope.substitute(substitution, originalVariable.superInterfaces);
          if (originalVariable.firstBound != null) {
            substitutedVariable.firstBound = originalVariable.firstBound == originalVariable.superclass
                ? substitutedSuperclass // could be array type or interface
                    : substitutedInterfaces[0];
          }
          switch (substitutedSuperclass.kind()) {
            case Binding.ARRAY_TYPE :
              substitutedVariable.superclass = environment.getResolvedType(TypeConstants.JAVA_LANG_OBJECT, null);
              substitutedVariable.superInterfaces = substitutedInterfaces;
              break;
            default:
              if (substitutedSuperclass.isInterface()) {
                substitutedVariable.superclass = environment.getResolvedType(TypeConstants.JAVA_LANG_OBJECT, null);
                int interfaceCount = substitutedInterfaces.length;
                System.arraycopy(substitutedInterfaces, 0, substitutedInterfaces = new ReferenceBinding[interfaceCount+1], 1, interfaceCount);
                substitutedInterfaces[0] = (ReferenceBinding) substitutedSuperclass;
                substitutedVariable.superInterfaces = substitutedInterfaces;
              } else {
                substitutedVariable.superclass = (ReferenceBinding) substitutedSuperclass; // typeVar was extending other typeVar which got substituted with interface
                substitutedVariable.superInterfaces = substitutedInterfaces;
              }
          }
        }
      }
        TypeVariableBinding[] returnTypeParameters = new TypeVariableBinding[classTypeVariablesArity];
      for (int j = 0; j < classTypeVariablesArity; j++) {
        returnTypeParameters[j] = (TypeVariableBinding) map.get(classTypeVariables[j]);
      }
      staticFactory.returnType = environment.createParameterizedType(allocationType, returnTypeParameters, allocationType.enclosingType());
      staticFactory.parameters = Scope.substitute(substitution, method.parameters);
      staticFactory.thrownExceptions = Scope.substitute(substitution, method.thrownExceptions);
      if (staticFactory.thrownExceptions == null) {
View Full Code Here

}
SimpleLookupTable storedAnnotations(boolean forceInitialize) {
  if (forceInitialize && this.storedAnnotations == null) {
    if (!this.environment.globalOptions.storeAnnotations)
      return null; // not supported during this compile
    this.storedAnnotations = new SimpleLookupTable(3);
  }
  return this.storedAnnotations;
}
View Full Code Here

  this.defaultImports = null;
  this.nameEnvironment = nameEnvironment;
  this.knownPackages = new HashtableOfPackage();
  this.uniqueArrayBindings = new ArrayBinding[5][];
  this.uniqueArrayBindings[0] = new ArrayBinding[50]; // start off the most common 1 dimension array @ 50
  this.uniqueParameterizedTypeBindings = new SimpleLookupTable(3);
  this.uniqueRawTypeBindings = new SimpleLookupTable(3);
  this.uniqueWildcardBindings = new SimpleLookupTable(3);
  this.uniqueParameterizedGenericMethodBindings = new SimpleLookupTable(3);
  this.uniquePolymorphicMethodBindings = new SimpleLookupTable(3);
  this.missingTypes = null;
  this.accessRestrictions = new HashMap(3);
  this.classFilePool = ClassFilePool.newInstance();
  this.typesBeingConnected = new HashSet();
}
View Full Code Here

TOP

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

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.