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

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


  public IPackageFragmentRoot[] computePackageFragmentRoots(
          IClasspathEntry[] resolvedClasspath,
          boolean retrieveExportedRoots,
          Map rootToResolvedEntries) throws JavaModelException {

    ObjectVector accumulatedRoots = new ObjectVector();
    computePackageFragmentRoots(
      resolvedClasspath,
      accumulatedRoots,
      new HashSet(5), // rootIDs
      null, // inside original project
      true, // check existency
      retrieveExportedRoots,
      rootToResolvedEntries);
    IPackageFragmentRoot[] rootArray = new IPackageFragmentRoot[accumulatedRoots.size()];
    accumulatedRoots.copyInto(rootArray);
    return rootArray;
  }
View Full Code Here


   * @return IClasspathEntry[]
   * @throws JavaModelException
   */
  public IClasspathEntry[] getExpandedClasspath()  throws JavaModelException {
     
      ObjectVector accumulatedEntries = new ObjectVector();   
      computeExpandedClasspath(null, new HashSet(5), accumulatedEntries);
     
      IClasspathEntry[] expandedPath = new IClasspathEntry[accumulatedEntries.size()];
      accumulatedEntries.copyInto(expandedPath);
     
      return expandedPath;
  }
View Full Code Here

          break;
      }
    }
   
    if(acceptedTypes == null) {
      acceptedTypes = new ObjectVector();
    }
    acceptedTypes.add(new AcceptedType(packageName, simpleTypeName, enclosingTypeNames, modifiers, accessibility));
  }
View Full Code Here

      CompletionOnFieldType field = (CompletionOnFieldType) astNode;
      CompletionOnSingleTypeReference type = (CompletionOnSingleTypeReference) field.type;
      this.completionToken = type.token;
      setSourceRange(type.sourceStart, type.sourceEnd);
     
      findTypesAndPackages(this.completionToken, scope, new ObjectVector());
      if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
        findKeywordsForMember(this.completionToken, field.modifiers);
      }
     
      if (!field.isLocalVariable && field.modifiers == ClassFileConstants.AccDefault) {
        SourceTypeBinding enclosingType = scope.enclosingSourceType();
        if (!enclosingType.isAnnotationType()) {
          if (!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) {
            findMethods(this.completionToken,null,null,enclosingType,scope,new ObjectVector(),false,false,true,null,null,false,false,true,null, null, null, false);
          }
          if (!this.requestor.isIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION)) {
            proposeNewMethod(this.completionToken, enclosingType);
          }
        }
      }
    } else if (astNode instanceof CompletionOnMethodReturnType) {

      CompletionOnMethodReturnType method = (CompletionOnMethodReturnType) astNode;
      SingleTypeReference type = (CompletionOnSingleTypeReference) method.returnType;
      this.completionToken = type.token;
      setSourceRange(type.sourceStart, type.sourceEnd);
      findTypesAndPackages(this.completionToken, scope.parent, new ObjectVector());
      if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
        findKeywordsForMember(this.completionToken, method.modifiers);
      }

      if (method.modifiers == ClassFileConstants.AccDefault) {
        SourceTypeBinding enclosingType = scope.enclosingSourceType();
        if (!enclosingType.isAnnotationType()) {
          if (!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) {
            findMethods(this.completionToken,null,null,scope.enclosingSourceType(),scope,new ObjectVector(),false,false,true,null,null,false,false,true,null, null, null, false);
          }
          if (!this.requestor.isIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION)) {
            proposeNewMethod(this.completionToken, scope.enclosingSourceType());
          }
        }
      }
    } else if (astNode instanceof CompletionOnSingleNameReference) {

      CompletionOnSingleNameReference singleNameReference = (CompletionOnSingleNameReference) astNode;
      this.completionToken = singleNameReference.token;
      SwitchStatement switchStatement = astNodeParent instanceof SwitchStatement ? (SwitchStatement) astNodeParent : null;
      if (switchStatement != null
          && switchStatement.expression.resolvedType != null
          && switchStatement.expression.resolvedType.isEnum()) {
        if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
          this.assistNodeIsEnum = true;
          this.findEnumConstant(this.completionToken, (SwitchStatement) astNodeParent);
        }
      } else if (this.expectedTypesPtr > -1 && this.expectedTypes[0].isAnnotationType()) {
        findTypesAndPackages(this.completionToken, scope, new ObjectVector());
      } else {
        if (scope instanceof BlockScope && !this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) {
          char[][] alreadyDefinedName = computeAlreadyDefinedName((BlockScope)scope, singleNameReference);
         
          findUnresolvedReference(
              singleNameReference.sourceStart,
              singleNameReference.sourceEnd,
              (BlockScope)scope,
              alreadyDefinedName);
        }
        findVariablesAndMethods(
          this.completionToken,
          scope,
          singleNameReference,
          scope,
          insideTypeAnnotation,
          singleNameReference.isInsideAnnotationAttribute);
        // can be the start of a qualified type name
        findTypesAndPackages(this.completionToken, scope, new ObjectVector());
        if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
          if (this.completionToken != null && this.completionToken.length != 0) {
            findKeywords(this.completionToken, singleNameReference.possibleKeywords, false, false);
          } else {
            findTrueOrFalseKeywords(singleNameReference.possibleKeywords);
          }
        }
        if (singleNameReference.canBeExplicitConstructor && !this.requestor.isIgnored(CompletionProposal.METHOD_REF)){
          if (CharOperation.prefixEquals(this.completionToken, Keywords.THIS, false)) {
            ReferenceBinding ref = scope.enclosingSourceType();
            findExplicitConstructors(Keywords.THIS, ref, (MethodScope)scope, singleNameReference);
          } else if (CharOperation.prefixEquals(this.completionToken, Keywords.SUPER, false)) {
            ReferenceBinding ref = scope.enclosingSourceType();
            findExplicitConstructors(Keywords.SUPER, ref.superclass(), (MethodScope)scope, singleNameReference);
          }
        }
      }

    } else if (astNode instanceof CompletionOnSingleTypeReference) {

      CompletionOnSingleTypeReference singleRef = (CompletionOnSingleTypeReference) astNode;
     
      this.completionToken = singleRef.token;

      this.assistNodeIsClass = singleRef.isClass();
      this.assistNodeIsException = singleRef.isException();
      this.assistNodeIsInterface = singleRef.isInterface();
      this.assistNodeIsConstructor = singleRef.isConstructorType;
      this.assistNodeIsSuperType = singleRef.isSuperType();
     
      // can be the start of a qualified type name
      if (qualifiedBinding == null) {
        if (this.completionToken.length == 0 &&
            (astNodeParent instanceof ParameterizedSingleTypeReference ||
                astNodeParent instanceof ParameterizedQualifiedTypeReference)) {
          this.setSourceRange(astNode.sourceStart, astNode.sourceStart - 1, false);
         
          findParameterizedType((TypeReference)astNodeParent, scope);
        } else {
          ObjectVector typesFound = new ObjectVector();
          if (this.assistNodeIsException && astNodeParent instanceof TryStatement) {
            findExceptionFromTryStatement(
                this.completionToken,
                null,
                scope.enclosingSourceType(),
                (BlockScope)scope,
                typesFound);
          }
          findTypesAndPackages(this.completionToken, scope, typesFound);
        }
      } else if (!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
        findMemberTypes(
          this.completionToken,
          (ReferenceBinding) qualifiedBinding,
          scope,
          scope.enclosingSourceType(),
          false,
          false,
          false,
          false,
          !this.assistNodeIsConstructor,
          null,
          new ObjectVector());
      }
    } else if (astNode instanceof CompletionOnQualifiedNameReference) {

      this.insideQualifiedReference = true;
      CompletionOnQualifiedNameReference ref =
        (CompletionOnQualifiedNameReference) astNode;
      this.completionToken = ref.completionIdentifier;
      long completionPosition = ref.sourcePositions[ref.sourcePositions.length - 1];

      if (qualifiedBinding.problemId() == ProblemReasons.NotFound) {
        setSourceRange((int) (completionPosition >>> 32), (int) completionPosition);
        // complete field members with missing fields type
        // class X {
        //   Missing f;
        //   void foo() {
        //     f.|
        //   }
        // }
        if (this.assistNodeInJavadoc == 0 &&
            (this.requestor.isAllowingRequiredProposals(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_REF) ||
                this.requestor.isAllowingRequiredProposals(CompletionProposal.METHOD_REF, CompletionProposal.TYPE_REF))) {
          if(ref.tokens.length == 1) {
            findFieldsAndMethodsFromMissingFieldType(ref.tokens[0], scope, ref, insideTypeAnnotation);
          }
        }
      } else if (qualifiedBinding instanceof VariableBinding) {
        setSourceRange((int) (completionPosition >>> 32), (int) completionPosition);
        TypeBinding receiverType = ((VariableBinding) qualifiedBinding).type;
        if (receiverType != null) {
          findFieldsAndMethods(this.completionToken, receiverType.capture(scope, ref.sourceEnd), scope, ref, scope,false,false, null, null, null, false);
        } else if (this.assistNodeInJavadoc == 0 &&
            (this.requestor.isAllowingRequiredProposals(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_REF) ||
                this.requestor.isAllowingRequiredProposals(CompletionProposal.METHOD_REF, CompletionProposal.TYPE_REF))) {
          boolean proposeField = !this.requestor.isIgnored(CompletionProposal.FIELD_REF);
          boolean proposeMethod = !this.requestor.isIgnored(CompletionProposal.METHOD_REF);
          if (proposeField || proposeMethod) {
            if (qualifiedBinding instanceof LocalVariableBinding) {
              // complete local variable members with missing variables type
              // class X {
              //   void foo() {
              //     Missing f;
              //     f.|
              //   }
              // }
              LocalVariableBinding localVariableBinding = (LocalVariableBinding) qualifiedBinding;
             
              findFieldsAndMethodsFromMissingType(
                  this.completionToken,
                  localVariableBinding.declaration.type,
                  localVariableBinding.declaringScope,
                  ref,
                  scope);
            }
          }
        }

      } else if (qualifiedBinding instanceof ReferenceBinding && !(qualifiedBinding instanceof TypeVariableBinding)) {
        boolean isInsideAnnotationAttribute = ref.isInsideAnnotationAttribute;
        ReferenceBinding receiverType = (ReferenceBinding) qualifiedBinding;
        setSourceRange((int) (completionPosition >>> 32), (int) completionPosition);

        if (!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
          findMemberTypes(
              this.completionToken,
              receiverType,
              scope,
              scope.enclosingSourceType(),
              false,
              true,
              new ObjectVector());
        }
        if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
          findClassField(this.completionToken, (TypeBinding) qualifiedBinding, scope);
        }
       
        MethodScope methodScope = null;
        if (!isInsideAnnotationAttribute &&
            !this.requestor.isIgnored(CompletionProposal.KEYWORD) &&
            ((scope instanceof MethodScope && !((MethodScope)scope).isStatic)
            || ((methodScope = scope.enclosingMethodScope()) != null && !methodScope.isStatic))) {
          if (this.completionToken.length > 0) {
            findKeywords(this.completionToken, new char[][]{Keywords.THIS}, false, true);
          } else {
            int relevance = computeBaseRelevance();
            relevance += computeRelevanceForResolution();
            relevance += computeRelevanceForInterestingProposal();
            relevance += computeRelevanceForCaseMatching(this.completionToken, Keywords.THIS);
            relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for keywords
            relevance += R_NON_INHERITED;
           
            this.noProposal = false;
            if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
              CompletionProposal proposal = this.createProposal(CompletionProposal.KEYWORD, this.actualCompletionPosition);
              proposal.setName(Keywords.THIS);
              proposal.setCompletion(Keywords.THIS);
              proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
              proposal.setRelevance(relevance);
              this.requestor.accept(proposal);
              if (DEBUG) {
                this.printDebug(proposal);
              }
            }
          }
        }

        if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
          findFields(
            this.completionToken,
            receiverType,
            scope,
            new ObjectVector(),
            new ObjectVector(),
            true,
            ref,
            scope,
            false,
            false,
            null,
            null,
            null,
            false);
        }

        if (!isInsideAnnotationAttribute && !this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
          findMethods(
            this.completionToken,
            null,
            null,
            receiverType,
            scope,
            new ObjectVector(),
            true,
            false,
            false,
            ref,
            scope,
            false,
            false,
            false,
            null,
            null,
            null,
            false);
        }

      } else if (qualifiedBinding instanceof PackageBinding) {

        setSourceRange(astNode.sourceStart, (int) completionPosition);
        // replace to the end of the completion identifier
        findTypesAndSubpackages(this.completionToken, (PackageBinding) qualifiedBinding, scope);
      }
    } else if (astNode instanceof CompletionOnQualifiedTypeReference) {

      this.insideQualifiedReference = true;
     
      CompletionOnQualifiedTypeReference ref =
        (CompletionOnQualifiedTypeReference) astNode;
     
      this.assistNodeIsClass = ref.isClass();
      this.assistNodeIsException = ref.isException();
      this.assistNodeIsInterface = ref.isInterface();
      this.assistNodeIsSuperType = ref.isSuperType();
     
      this.completionToken = ref.completionIdentifier;
      long completionPosition = ref.sourcePositions[ref.tokens.length];

      // get the source positions of the completion identifier
      if (qualifiedBinding instanceof ReferenceBinding && !(qualifiedBinding instanceof TypeVariableBinding)) {
        if (!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
          setSourceRange((int) (completionPosition >>> 32), (int) completionPosition);
         
          ObjectVector typesFound = new ObjectVector();
         
          if (this.assistNodeIsException && astNodeParent instanceof TryStatement) {
            findExceptionFromTryStatement(
                this.completionToken,
                (ReferenceBinding)qualifiedBinding,
                scope.enclosingSourceType(),
                (BlockScope)scope,
                typesFound);
          }
         
          findMemberTypes(
            this.completionToken,
            (ReferenceBinding) qualifiedBinding,
            scope,
            scope.enclosingSourceType(),
            false,
            false,
            typesFound);
        }
      } else if (qualifiedBinding instanceof PackageBinding) {

        setSourceRange(astNode.sourceStart, (int) completionPosition);
        // replace to the end of the completion identifier
        findTypesAndSubpackages(this.completionToken, (PackageBinding) qualifiedBinding, scope);
      }
    } else if (astNode instanceof CompletionOnMemberAccess) {
      this.insideQualifiedReference = true;
      CompletionOnMemberAccess access = (CompletionOnMemberAccess) astNode;
      long completionPosition = access.nameSourcePosition;
      setSourceRange((int) (completionPosition >>> 32), (int) completionPosition);

      this.completionToken = access.token;
     
      if (qualifiedBinding.problemId() == ProblemReasons.NotFound) {
        // complete method members with missing return type
        // class X {
        //   Missing f() {return null;}
        //   void foo() {
        //     f().|
        //   }
        // }
        if (this.assistNodeInJavadoc == 0 &&
            (this.requestor.isAllowingRequiredProposals(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_REF) ||
                this.requestor.isAllowingRequiredProposals(CompletionProposal.METHOD_REF, CompletionProposal.TYPE_REF))) {
          ProblemMethodBinding problemMethodBinding = (ProblemMethodBinding) qualifiedBinding;       
          findFieldsAndMethodsFromMissingReturnType(
              problemMethodBinding.selector,
              problemMethodBinding.parameters,
              scope,
              access,
              insideTypeAnnotation);
        }
      } else {
        if (!access.isInsideAnnotation) {
          if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
            findKeywords(this.completionToken, new char[][]{Keywords.NEW}, false, false);
          }
         
          findFieldsAndMethods(
            this.completionToken,
            ((TypeBinding) qualifiedBinding).capture(scope, access.receiver.sourceEnd),
            scope,
            access,
            scope,
            false,
            access.receiver instanceof SuperReference,
            null,
            null,
            null,
            false);
        }
      }

    } else if (astNode instanceof CompletionOnMessageSend) {
      setSourceRange(astNode.sourceStart, astNode.sourceEnd, false);
     
      CompletionOnMessageSend messageSend = (CompletionOnMessageSend) astNode;
      TypeBinding[] argTypes = computeTypes(messageSend.arguments);
      this.completionToken = messageSend.selector;
      if (qualifiedBinding == null) {
        if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
          findImplicitMessageSends(this.completionToken, argTypes, scope, messageSend, scope);
        }
      } else  if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
        findMethods(
          this.completionToken,
          null,
          argTypes,
          (ReferenceBinding)((ReferenceBinding) qualifiedBinding).capture(scope, messageSend.receiver.sourceEnd),
          scope,
          new ObjectVector(),
          false,
          true,
          false,
          messageSend,
          scope,
          false,
          messageSend.receiver instanceof SuperReference,
          false,
          null,
          null,
          null,
          false);
      }
    } else if (astNode instanceof CompletionOnExplicitConstructorCall) {
      if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
        setSourceRange(astNode.sourceStart, astNode.sourceEnd, false);
       
        CompletionOnExplicitConstructorCall constructorCall =
          (CompletionOnExplicitConstructorCall) astNode;
        TypeBinding[] argTypes = computeTypes(constructorCall.arguments);
        findConstructors(
          (ReferenceBinding) qualifiedBinding,
          argTypes,
          scope,
          constructorCall,
          false);
                  }
    } else if (astNode instanceof CompletionOnQualifiedAllocationExpression) {
      setSourceRange(astNode.sourceStart, astNode.sourceEnd, false);
     
      CompletionOnQualifiedAllocationExpression allocExpression =
        (CompletionOnQualifiedAllocationExpression) astNode;
      TypeBinding[] argTypes = computeTypes(allocExpression.arguments);
     
      ReferenceBinding ref = (ReferenceBinding) qualifiedBinding;
      if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)
          && ref.isClass()
          && !ref.isAbstract()) {
          findConstructors(
            ref,
            argTypes,
            scope,
            allocExpression,
            false);
      }
      if (!this.requestor.isIgnored(CompletionProposal.ANONYMOUS_CLASS_DECLARATION)
          && !ref.isFinal()
          && !ref.isEnum()){
        findAnonymousType(
          ref,
          argTypes,
          scope,
          allocExpression);
      }
    } else if (astNode instanceof CompletionOnClassLiteralAccess) {
      if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
        CompletionOnClassLiteralAccess access = (CompletionOnClassLiteralAccess) astNode;
        setSourceRange(access.classStart, access.sourceEnd);

        this.completionToken = access.completionIdentifier;

        findClassField(this.completionToken, (TypeBinding) qualifiedBinding, scope);
      }
    } else if (astNode instanceof CompletionOnMethodName) {
      if (!this.requestor.isIgnored(CompletionProposal.VARIABLE_DECLARATION)) {
        CompletionOnMethodName method = (CompletionOnMethodName) astNode;
         
        setSourceRange(method.sourceStart, method.selectorEnd);
         
        FieldBinding[] fields = scope.enclosingSourceType().fields();
        char[][] excludeNames = new char[fields.length][];
        for(int i = 0 ; i < fields.length ; i++){
          excludeNames[i] = fields[i].name;
        }
       
        this.completionToken = method.selector;
       
        findVariableNames(this.completionToken, method.returnType, excludeNames, null, FIELD, method.modifiers);
      }
    } else if (astNode instanceof CompletionOnFieldName) {
      if (!this.requestor.isIgnored(CompletionProposal.VARIABLE_DECLARATION)) {
        CompletionOnFieldName field = (CompletionOnFieldName) astNode;
       
        FieldBinding[] fields = scope.enclosingSourceType().fields();
        char[][] excludeNames = new char[fields.length][];
        for(int i = 0 ; i < fields.length ; i++){
          excludeNames[i] = fields[i].name;
        }
       
        this.completionToken = field.realName;
       
        findVariableNames(field.realName, field.type, excludeNames, null, FIELD, field.modifiers);
      }
    } else if (astNode instanceof CompletionOnLocalName || astNode instanceof CompletionOnArgumentName) {
      if (!this.requestor.isIgnored(CompletionProposal.VARIABLE_DECLARATION)) {
        LocalDeclaration variable = (LocalDeclaration) astNode;
       
        int kind;
        if (variable instanceof CompletionOnLocalName){
          this.completionToken = ((CompletionOnLocalName) variable).realName;
          kind = LOCAL;
        } else {
          CompletionOnArgumentName arg = (CompletionOnArgumentName) variable;
          this.completionToken = arg.realName;
          kind = arg.isCatchArgument ? LOCAL : ARGUMENT;
        }
       
        char[][] alreadyDefinedName = computeAlreadyDefinedName((BlockScope)scope, variable);
       
        char[][] forbiddenNames = findVariableFromUnresolvedReference(variable, (BlockScope)scope, alreadyDefinedName);
       
        LocalVariableBinding[] locals = ((BlockScope)scope).locals;
        char[][] discouragedNames = new char[locals.length][];
        int localCount = 0;
        for(int i = 0 ; i < locals.length ; i++){
          if (locals[i] != null) {
            discouragedNames[localCount++] = locals[i].name;
          }
        }
       
        System.arraycopy(discouragedNames, 0, discouragedNames = new char[localCount][], 0, localCount);
       
        findVariableNames(this.completionToken, variable.type, discouragedNames, forbiddenNames, kind, variable.modifiers);
      }
    } else if (astNode instanceof CompletionOnKeyword) {
      if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) {
        CompletionOnKeyword keyword = (CompletionOnKeyword)astNode;
        findKeywords(keyword.getToken(), keyword.getPossibleKeywords(), keyword.canCompleteEmptyToken(), false);
      }
    } else if (astNode instanceof CompletionOnParameterizedQualifiedTypeReference) {
      if (!this.requestor.isIgnored(CompletionProposal.TYPE_REF)) {
        CompletionOnParameterizedQualifiedTypeReference ref = (CompletionOnParameterizedQualifiedTypeReference) astNode;
       
        this.insideQualifiedReference = true;

        this.assistNodeIsClass = ref.isClass();
        this.assistNodeIsException = ref.isException();
        this.assistNodeIsInterface = ref.isInterface();
        this.assistNodeIsSuperType = ref.isSuperType();
       
        this.completionToken = ref.completionIdentifier;
        long completionPosition = ref.sourcePositions[ref.tokens.length];
        setSourceRange((int) (completionPosition >>> 32), (int) completionPosition);
       
        ObjectVector typesFound = new ObjectVector();
        if (this.assistNodeIsException && astNodeParent instanceof TryStatement) {
          findExceptionFromTryStatement(
              this.completionToken,
              (ReferenceBinding)qualifiedBinding,
              scope.enclosingSourceType(),
              (BlockScope)scope,
              typesFound);
        }
       
        findMemberTypes(
          this.completionToken,
          (ReferenceBinding) qualifiedBinding,
          scope,
          scope.enclosingSourceType(),
          false,
          false,
          typesFound);
      }
    } else if (astNode instanceof CompletionOnMarkerAnnotationName) {
      CompletionOnMarkerAnnotationName annot = (CompletionOnMarkerAnnotationName) astNode;
     
      CompletionOnAnnotationOfType fakeType = (CompletionOnAnnotationOfType)scope.parent.referenceContext();
      if (fakeType.annotations[0] == annot) {
        // When the completion is inside a method body the annotation cannot be accuratly attached to the correct node by completion recovery.
        // So 'targetedElement' is not computed in this case.
        if (scope.parent.parent == null || !(scope.parent.parent instanceof MethodScope)) {
          this.targetedElement = computeTargetedElement(fakeType);
        }
       
      }
     
      this.assistNodeIsAnnotation = true;
      if (annot.type instanceof CompletionOnSingleTypeReference) {
        CompletionOnSingleTypeReference type = (CompletionOnSingleTypeReference) annot.type;
        this.completionToken = type.token;
        setSourceRange(type.sourceStart, type.sourceEnd);
       
        findTypesAndPackages(this.completionToken, scope, new ObjectVector());
      } else if (annot.type instanceof CompletionOnQualifiedTypeReference) {
        this.insideQualifiedReference = true;
       
        CompletionOnQualifiedTypeReference type = (CompletionOnQualifiedTypeReference) annot.type;
        this.completionToken = type.completionIdentifier;
        long completionPosition = type.sourcePositions[type.tokens.length];
        if (qualifiedBinding instanceof PackageBinding) {

          setSourceRange(astNode.sourceStart, (int) completionPosition);
          // replace to the end of the completion identifier
          findTypesAndSubpackages(this.completionToken, (PackageBinding) qualifiedBinding, scope);
        } else {
          setSourceRange((int) (completionPosition >>> 32), (int) completionPosition);

          findMemberTypes(
            this.completionToken,
            (ReferenceBinding) qualifiedBinding,
            scope,
            scope.enclosingSourceType(),
            false,
            false,
            new ObjectVector());
        }
      }
    } else if (astNode instanceof CompletionOnMemberValueName) {
      CompletionOnMemberValueName memberValuePair = (CompletionOnMemberValueName) astNode;
      Annotation annotation = (Annotation) astNodeParent;
     
      this.completionToken = memberValuePair.name;
     
      ReferenceBinding annotationType = (ReferenceBinding)annotation.resolvedType;
     
      if (annotationType != null && annotationType.isAnnotationType()) {
        if (!this.requestor.isIgnored(CompletionProposal.ANNOTATION_ATTRIBUTE_REF)) {
          this.findAnnotationAttributes(this.completionToken, annotation.memberValuePairs(), annotationType);
        }
        if (this.assistNodeCanBeSingleMemberAnnotation) {
          if (this.expectedTypesPtr > -1 && this.expectedTypes[0].isAnnotationType()) {
            findTypesAndPackages(this.completionToken, scope, new ObjectVector());
          } else {
            if (scope instanceof BlockScope && !this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) {
              char[][] alreadyDefinedName = computeAlreadyDefinedName((BlockScope)scope, FakeInvocationSite);
             
              findUnresolvedReference(
                  memberValuePair.sourceStart,
                  memberValuePair.sourceEnd,
                  (BlockScope)scope,
                  alreadyDefinedName);
            }
            findVariablesAndMethods(
              this.completionToken,
              scope,
              FakeInvocationSite,
              scope,
              insideTypeAnnotation,
              true);
            // can be the start of a qualified type name
            findTypesAndPackages(this.completionToken, scope, new ObjectVector());
          }
        }
      }
    } else if(astNode instanceof CompletionOnBrankStatementLabel) {
      if (!this.requestor.isIgnored(CompletionProposal.LABEL_REF)) {
        CompletionOnBrankStatementLabel label = (CompletionOnBrankStatementLabel) astNode;
       
        this.completionToken = label.label;
       
        this.findLabels(this.completionToken, label.possibleLabels);
      }
    } else if(astNode instanceof CompletionOnMessageSendName) {
      if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
        CompletionOnMessageSendName messageSend = (CompletionOnMessageSendName) astNode;
       
        this.insideQualifiedReference = true;
        this.completionToken = messageSend.selector;
        boolean onlyStatic = false;
        TypeBinding receiverType = null;
        if(qualifiedBinding instanceof VariableBinding) {
          receiverType = ((VariableBinding)qualifiedBinding).type;
        } else if(qualifiedBinding instanceof MethodBinding) {
          receiverType = ((MethodBinding)qualifiedBinding).returnType;
        } else if(qualifiedBinding instanceof ReferenceBinding && !(qualifiedBinding instanceof TypeVariableBinding)) {
          onlyStatic = true;
          receiverType = (TypeBinding)qualifiedBinding;
        }
        if(receiverType != null && receiverType instanceof ReferenceBinding) {
          TypeBinding[] typeArgTypes = computeTypesIfCorrect(messageSend.typeArguments);
          if(typeArgTypes != null) {
            this.findMethods(
                this.completionToken,
                typeArgTypes,
                null,
                (ReferenceBinding)receiverType.capture(scope, messageSend.receiver.sourceEnd),
                scope,
                new ObjectVector(),
                onlyStatic,
                false,
                false,
                messageSend,
                scope,
                false,
                false,
                false,
                null,
                null,
                null,
                false);
          }
        }
      }
    // Completion on Javadoc nodes
    } else if ((astNode.bits & ASTNode.InsideJavadoc) != 0) {
      if (astNode instanceof CompletionOnJavadocSingleTypeReference) {

        CompletionOnJavadocSingleTypeReference typeRef = (CompletionOnJavadocSingleTypeReference) astNode;
        this.completionToken = typeRef.token;
        this.javadocTagPosition = typeRef.tagSourceStart;
        setSourceRange(typeRef.sourceStart, typeRef.sourceEnd);
        findTypesAndPackages(this.completionToken, scope, new ObjectVector());

      } else if (astNode instanceof CompletionOnJavadocQualifiedTypeReference) {

        this.insideQualifiedReference = true;

        CompletionOnJavadocQualifiedTypeReference typeRef = (CompletionOnJavadocQualifiedTypeReference) astNode;
        this.completionToken = typeRef.completionIdentifier;
        long completionPosition = typeRef.sourcePositions[typeRef.tokens.length];
        this.javadocTagPosition = typeRef.tagSourceStart;

        // get the source positions of the completion identifier
        if (qualifiedBinding instanceof ReferenceBinding && !(qualifiedBinding instanceof TypeVariableBinding)) {
          if (!this.requestor.isIgnored(CompletionProposal.TYPE_REF) ||
              ((this.assistNodeInJavadoc & CompletionOnJavadoc.TEXT) != 0 && !this.requestor.isIgnored(CompletionProposal.JAVADOC_TYPE_REF))) {
            int rangeStart = typeRef.completeInText() ? typeRef.sourceStart : (int) (completionPosition >>> 32);
            setSourceRange(rangeStart, (int) completionPosition);
            findMemberTypes(this.completionToken,
              (ReferenceBinding) qualifiedBinding,
              scope,
              scope.enclosingSourceType(),
              false,
              false,
              new ObjectVector());
          }
        } else if (qualifiedBinding instanceof PackageBinding) {

          setSourceRange(astNode.sourceStart, (int) completionPosition);
          // replace to the end of the completion identifier
          findTypesAndSubpackages(this.completionToken, (PackageBinding) qualifiedBinding, scope);
        }
      } else if (astNode instanceof CompletionOnJavadocFieldReference) {

        this.insideQualifiedReference = true;
        CompletionOnJavadocFieldReference fieldRef = (CompletionOnJavadocFieldReference) astNode;
        this.completionToken = fieldRef.token;
        long completionPosition = fieldRef.nameSourcePosition;
        this.javadocTagPosition = fieldRef.tagSourceStart;

        if (fieldRef.receiverType != null && fieldRef.receiverType.isValidBinding()) {
          ReferenceBinding receiverType = (ReferenceBinding) fieldRef.receiverType;
          int rangeStart = (int) (completionPosition >>> 32);
          if (fieldRef.receiver.isThis()) {
            if (fieldRef.completeInText()) {
              rangeStart = fieldRef.separatorPosition;
            }
          } else if (fieldRef.completeInText()) {
            rangeStart = fieldRef.receiver.sourceStart;
          }
          setSourceRange(rangeStart, (int) completionPosition);

          if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)
              || !this.requestor.isIgnored(CompletionProposal.JAVADOC_FIELD_REF)) {
            findFields(this.completionToken,
              receiverType,
              scope,
              new ObjectVector(),
              new ObjectVector(),
              false, /*not only static */
              fieldRef,
              scope,
              false,
              true,
              null,
              null,
              null,
              false);
          }

          if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)
              || !this.requestor.isIgnored(CompletionProposal.JAVADOC_METHOD_REF)) {
            findMethods(this.completionToken,
              null,
              null,
              receiverType,
              scope,
              new ObjectVector(),
              false, /*not only static */
              false,
              false,
              fieldRef,
              scope,
              false,
              false,
              true,
              null,
              null,
              null,
              false);
            if (fieldRef.receiverType instanceof ReferenceBinding) {
              ReferenceBinding refBinding = (ReferenceBinding)fieldRef.receiverType;
              if (this.completionToken == null
                  || CharOperation.prefixEquals(this.completionToken, refBinding.sourceName)
                  || (this.options.camelCaseMatch && CharOperation.camelCaseMatch(this.completionToken, refBinding.sourceName))) {
                findConstructors(refBinding, null, scope, fieldRef, false);
              }
            }
          }
        }
      } else if (astNode instanceof CompletionOnJavadocMessageSend) {

        CompletionOnJavadocMessageSend messageSend = (CompletionOnJavadocMessageSend) astNode;
        TypeBinding[] argTypes = null; //computeTypes(messageSend.arguments);
        this.completionToken = messageSend.selector;
        this.javadocTagPosition = messageSend.tagSourceStart;

        // Set source range
        int rangeStart = astNode.sourceStart;
        if (messageSend.receiver.isThis()) {
          if (messageSend.completeInText()) {
            rangeStart = messageSend.separatorPosition;
          }
        } else if (messageSend.completeInText()) {
          rangeStart = messageSend.receiver.sourceStart;
        }
        setSourceRange(rangeStart, astNode.sourceEnd, false);

        if (qualifiedBinding == null) {
          if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
            findImplicitMessageSends(this.completionToken, argTypes, scope, messageSend, scope);
          }
        } else if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) {
          findMethods(
            this.completionToken,
            null,
            argTypes,
            (ReferenceBinding) ((ReferenceBinding) qualifiedBinding).capture(scope, messageSend.receiver.sourceEnd),
            scope,
            new ObjectVector(),
            false,
            false/* prefix match */,
            false,
            messageSend,
            scope,
 
View Full Code Here

    Binding[] missingElements,
    int[] missingElementsStarts,
    int[] missingElementsEnds,
    boolean missingElementsHaveProblems) {

    ObjectVector newFieldsFound = new ObjectVector();
    // Inherited fields which are hidden by subclasses are filtered out
    // No visibility checks can be performed without the scope & invocationSite
   
    int fieldLength = fieldName.length;
    next : for (int f = fields.length; --f >= 0;) {     
      FieldBinding field = fields[f];

      if (field.isSynthetic())  continue next;
     
      if (onlyStaticFields && !field.isStatic()) continue next;

      if (fieldLength > field.name.length) continue next;

      if (!CharOperation.prefixEquals(fieldName, field.name, false /* ignore case */)
          && !(this.options.camelCaseMatch && CharOperation.camelCaseMatch(fieldName, field.name)))  continue next;

      if (this.options.checkDeprecation &&
          field.isViewedAsDeprecated() &&
          !scope.isDefinedInSameUnit(field.declaringClass))
        continue next;
     
      if (this.options.checkVisibility
        && !field.canBeSeenBy(receiverType, invocationSite, scope))  continue next;

      boolean prefixRequired = false;

      for (int i = fieldsFound.size; --i >= 0;) {
        Object[] other = (Object[])fieldsFound.elementAt(i);
        FieldBinding otherField = (FieldBinding) other[0];
        ReferenceBinding otherReceiverType = (ReferenceBinding) other[1];
        if (field == otherField && receiverType == otherReceiverType)
          continue next;
        if (CharOperation.equals(field.name, otherField.name, true)) {
          if (field.declaringClass.isSuperclassOf(otherField.declaringClass))
            continue next;
          if (otherField.declaringClass.isInterface()) {
            if (field.declaringClass == scope.getJavaLangObject())
              continue next;
            if (field.declaringClass.implementsInterface(otherField.declaringClass, true))
              continue next;
          }
          if (field.declaringClass.isInterface())
            if (otherField.declaringClass.implementsInterface(field.declaringClass, true))
              continue next;
          if(canBePrefixed) {
            prefixRequired = true;
          } else {
            continue next;
          }
        }
      }

      for (int l = localsFound.size; --l >= 0;) {
        LocalVariableBinding local = (LocalVariableBinding) localsFound.elementAt(l)

        if (CharOperation.equals(field.name, local.name, true)) {
          SourceTypeBinding declarationType = scope.enclosingSourceType();
          if (declarationType.isAnonymousType() && declarationType != invocationScope.enclosingSourceType()) {
            continue next;
          }
          if(canBePrefixed) {
            prefixRequired = true;
          } else {
            continue next;
          }
          break;
        }
      }
     
      newFieldsFound.add(new Object[]{field, receiverType});
     
      char[] completion = field.name;
     
      if(prefixRequired || this.options.forceImplicitQualification){
        char[] prefix = computePrefix(scope.enclosingSourceType(), invocationScope.enclosingSourceType(), field.isStatic());
View Full Code Here

      return; // nothing else is possible with base types
   
    boolean proposeField = !this.isIgnored(CompletionProposal.FIELD_REF, missingElements != null);
    boolean proposeMethod = !this.isIgnored(CompletionProposal.METHOD_REF, missingElements != null);
   
    ObjectVector methodsFound = new ObjectVector();
   
    if (receiverType.isArrayType()) {
      if (proposeField
        && token.length <= lengthField.length
        && CharOperation.prefixEquals(token, lengthField, false /* ignore case */
      )) {
       
        int relevance = computeBaseRelevance();
        relevance += computeRelevanceForResolution();
        relevance += computeRelevanceForInterestingProposal();
        relevance += computeRelevanceForCaseMatching(token,lengthField);
        relevance += computeRelevanceForExpectingType(TypeBinding.INT);
        relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for length field
        if (missingElements != null) {
          relevance += computeRelevanceForMissingElements(missingElementsHaveProblems);
        }
        this.noProposal = false;
        if(!isIgnored(CompletionProposal.FIELD_REF, missingElements != null)) {
          CompletionProposal proposal = this.createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition);
          proposal.setDeclarationSignature(getSignature(receiverType));
          proposal.setSignature(INT_SIGNATURE);
          //proposal.setDeclarationPackageName(null);
          //proposal.setDeclarationTypeName(null);
          //proposal.setPackageName(null);
          proposal.setTypeName(INT);
          proposal.setName(lengthField);
          if (missingElements != null) {
            CompletionProposal[] subProposals = new CompletionProposal[missingElements.length];
            for (int i = 0; i < missingElements.length; i++) {
              subProposals[i] =
                createRequiredTypeProposal(
                    missingElements[i],
                    missingElementsStarts[i],
                    missingElementsEnds[i],
                    relevance);
            }
            proposal.setRequiredProposals(subProposals);
          }
          proposal.setCompletion(lengthField);
          proposal.setFlags(Flags.AccPublic);
          proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
          proposal.setRelevance(relevance);
          this.requestor.accept(proposal);
          if(DEBUG) {
            this.printDebug(proposal);
          }
        }
      }
      if (proposeMethod
        && token.length <= cloneMethod.length
        && CharOperation.prefixEquals(token, cloneMethod, false /* ignore case */)
      ) {
        ReferenceBinding objectRef = scope.getJavaLangObject();
       
        int relevance = computeBaseRelevance();
        relevance += computeRelevanceForResolution();
        relevance += computeRelevanceForInterestingProposal();
        relevance += computeRelevanceForCaseMatching(token, cloneMethod);
        relevance += computeRelevanceForExpectingType(objectRef);
        relevance += computeRelevanceForStatic(false, false);
        relevance += computeRelevanceForQualification(false);
        relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for clone() method
        if (missingElements != null) {
          relevance += computeRelevanceForMissingElements(missingElementsHaveProblems);
        }
        char[] completion;
        if (this.source != null
          && this.source.length > this.endPosition
          && this.source[this.endPosition] == '(') {
          completion = cloneMethod;
          } else {
          completion = CharOperation.concat(cloneMethod, new char[] { '(', ')' });
        }
        this.noProposal = false;
        if (!this.isIgnored(CompletionProposal.METHOD_REF, missingElements != null)) {
          CompletionProposal proposal = this.createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition);
          proposal.setDeclarationSignature(getSignature(receiverType));
          proposal.setSignature(
              this.compilerOptions.sourceLevel > ClassFileConstants.JDK1_4 && receiverType.isArrayType() ?
                  createMethodSignature(
                      CharOperation.NO_CHAR_CHAR,
                      CharOperation.NO_CHAR_CHAR,
                      getSignature(receiverType)) :
                  createMethodSignature(
                      CharOperation.NO_CHAR_CHAR,
                      CharOperation.NO_CHAR_CHAR,
                      CharOperation.concatWith(JAVA_LANG, '.'),
                      OBJECT));
          //proposal.setOriginalSignature(null);
          //proposal.setDeclarationPackageName(null);
          //proposal.setDeclarationTypeName(null);
          //proposal.setParameterPackageNames(null);
          //proposal.setParameterTypeNames(null);
          proposal.setPackageName(CharOperation.concatWith(JAVA_LANG, '.'));
          proposal.setTypeName(OBJECT);
          proposal.setName(cloneMethod);
          if (missingElements != null) {
            CompletionProposal[] subProposals = new CompletionProposal[missingElements.length];
            for (int i = 0; i < missingElements.length; i++) {
              subProposals[i] =
                createRequiredTypeProposal(
                    missingElements[i],
                    missingElementsStarts[i],
                    missingElementsEnds[i],
                    relevance);
            }
            proposal.setRequiredProposals(subProposals);
          }
          proposal.setCompletion(completion);
          proposal.setFlags(Flags.AccPublic);
          proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset);
          proposal.setRelevance(relevance);
          this.requestor.accept(proposal);
          if(DEBUG) {
            this.printDebug(proposal);
          }
        }
        methodsFound.add(new Object[]{objectRef.getMethods(cloneMethod)[0], objectRef});
      }
     
      receiverType = scope.getJavaLangObject();
    }

    if(proposeField) {
      findFields(
        token,
        (ReferenceBinding) receiverType,
        scope,
        new ObjectVector(),
        new ObjectVector(),
        false,
        invocationSite,
        invocationScope,
        implicitCall,
        false,
View Full Code Here

    if (token == null)
      return;

    boolean staticsOnly = false;
    // need to know if we're in a static context (or inside a constructor)
    ObjectVector methodsFound = new ObjectVector();

    done : while (true) { // done when a COMPILATION_UNIT_SCOPE is found

      switch (scope.kind) {
View Full Code Here

    Binding[] missingElements,
    int[] missingElementsStarts,
    int[] missingElementsEnds,
    boolean missingElementsHaveProblems) {

    ObjectVector newMethodsFound =  new ObjectVector();
    // Inherited methods which are hidden by subclasses are filtered out
    // No visibility checks can be performed without the scope & invocationSite

    int methodLength = methodName.length;
    int minTypeArgLength = typeArgTypes == null ? 0 : typeArgTypes.length;
    int minArgLength = argTypes == null ? 0 : argTypes.length;

    next : for (int f = methods.length; --f >= 0;) {
      MethodBinding method = methods[f];

      if (method.isSynthetic()) continue next;

      if (method.isDefaultAbstract())  continue next;

      if (method.isConstructor()) continue next;
     
      if (this.options.checkDeprecation &&
          method.isViewedAsDeprecated() &&
          !scope.isDefinedInSameUnit(method.declaringClass))
        continue next;

      //TODO (david) perhaps the relevance of a void method must be lesser than other methods
      //if (expectedTypesPtr > -1 && method.returnType == BaseTypes.VoidBinding) continue next;
     
      if (onlyStaticMethods && !method.isStatic()) continue next;

      if (this.options.checkVisibility
        && !method.canBeSeenBy(receiverType, invocationSite, scope)) continue next;

      if(superCall && method.isAbstract()) {
        methodsFound.add(new Object[]{method, receiverType});
        continue next;
      }

      if (exactMatch) {
        if (!CharOperation.equals(methodName, method.selector, false /* ignore case */)) {
          continue next;
        }
      } else {
        if (methodLength > method.selector.length) continue next;
        if (!CharOperation.prefixEquals(methodName, method.selector, false /* ignore case */)
            && !(this.options.camelCaseMatch && CharOperation.camelCaseMatch(methodName, method.selector))) {
          continue next;
        }
      }
     
      if (minTypeArgLength != 0 && minTypeArgLength != method.typeVariables.length)
        continue next;
     
      if (minTypeArgLength != 0) {
        method = scope.environment().createParameterizedGenericMethod(method, typeArgTypes);
      }
     
      if (minArgLength > method.parameters.length)
        continue next;

      for (int a = minArgLength; --a >= 0;){
        if (argTypes[a] != null) { // can be null if it could not be resolved properly
          if (!argTypes[a].isCompatibleWith(method.parameters[a])) {
            continue next;
          }
        }
      }
     
      boolean prefixRequired = false;
     
      for (int i = methodsFound.size; --i >= 0;) {
        Object[] other = (Object[]) methodsFound.elementAt(i);
        MethodBinding otherMethod = (MethodBinding) other[0];
        ReferenceBinding otherReceiverType = (ReferenceBinding) other[1];
        if (method == otherMethod && receiverType == otherReceiverType)
          continue next;
       
        if (CharOperation.equals(method.selector, otherMethod.selector, true)) {
          if (receiverType == otherReceiverType) {
            if (lookupEnvironment.methodVerifier().doesMethodOverride(otherMethod, method)) {
              if (!superCall || !otherMethod.declaringClass.isInterface()) {
                continue next;
              }
            }
          } else {
            if (lookupEnvironment.methodVerifier().doesMethodOverride(otherMethod, method)) {
              if(receiverType.isAnonymousType()) continue next;
             
              if(!superCall) {
                if(!canBePrefixed) continue next;
               
                prefixRequired = true;
              }
            }
          }
        }
      }

      newMethodsFound.add(new Object[]{method, receiverType});
     
      ReferenceBinding superTypeWithSameErasure = (ReferenceBinding)receiverType.findSuperTypeWithSameErasure(method.declaringClass);
      if (method.declaringClass != superTypeWithSameErasure) {
        MethodBinding[] otherMethods = superTypeWithSameErasure.getMethods(method.selector);
        for (int i = 0; i < otherMethods.length; i++) {
View Full Code Here

    Scope scope,
    ObjectVector methodsFound,
    ReferenceBinding receiverType,
    InvocationSite invocationSite) {
   
    ObjectVector newMethodsFound =  new ObjectVector();

    next : for (int f = methods.length; --f >= 0;) {
      MethodBinding method = methods[f];

      if (method.isSynthetic()) continue next;

      if (method.isDefaultAbstract())  continue next;

      if (method.isConstructor()) continue next;

      if (!method.isStatic()) continue next;
     
      if (this.options.checkDeprecation &&
          method.isViewedAsDeprecated() &&
          !scope.isDefinedInSameUnit(method.declaringClass))
        continue next;
     
      if (this.options.checkVisibility
        && !method.canBeSeenBy(receiverType, invocationSite, scope)) continue next;

      if (!CharOperation.equals(methodName, method.selector, false /* ignore case */)
          && !(this.options.camelCaseMatch && CharOperation.camelCaseMatch(methodName, method.selector)))
        continue next;
     
      for (int i = methodsFound.size; --i >= 0;) {
        Object[] other = (Object[]) methodsFound.elementAt(i);
        MethodBinding otherMethod = (MethodBinding) other[0];
        ReferenceBinding otherReceiverType = (ReferenceBinding) other[1];
        if (method == otherMethod && receiverType == otherReceiverType)
          continue next;
       
        if (CharOperation.equals(method.selector, otherMethod.selector, true)) {
          if (lookupEnvironment.methodVerifier().doesMethodOverride(otherMethod, method)) {
            continue next;
          }
        }
      }

      newMethodsFound.add(new Object[]{method, receiverType});

      int length = method.parameters.length;
      char[][] parameterPackageNames = new char[length][];
      char[][] parameterTypeNames = new char[length][];

View Full Code Here

    ObjectVector methodsFound,
    //  boolean noVoidReturnType, how do you know?
    boolean exactMatch,
    ReferenceBinding receiverType) {

    ObjectVector newMethodsFound =  new ObjectVector();
    // Inherited methods which are hidden by subclasses are filtered out
    // No visibility checks can be performed without the scope & invocationSite
    int methodLength = methodName.length;
    next : for (int f = methods.length; --f >= 0;) {

      MethodBinding method = methods[f];
      if (method.isSynthetic())  continue next;
       
      if (method.isDefaultAbstract()) continue next;
     
      if (method.isConstructor()) continue next;
       
      if (method.isFinal()) {
                newMethodsFound.add(method);
                continue next;
            }
     
      if (this.options.checkDeprecation &&
          method.isViewedAsDeprecated() &&
          !scope.isDefinedInSameUnit(method.declaringClass))
        continue next;

      //    if (noVoidReturnType && method.returnType == BaseTypes.VoidBinding) continue next;
      if(method.isStatic()) continue next;

      if (!method.canBeSeenBy(receiverType, FakeInvocationSite , scope)) continue next;

      if (exactMatch) {
        if (!CharOperation.equals(methodName, method.selector, false /* ignore case */
          ))
          continue next;

      } else {

        if (methodLength > method.selector.length)
          continue next;

        if (!CharOperation.prefixEquals(methodName, method.selector, false/* ignore case */)
            && !(this.options.camelCaseMatch && CharOperation.camelCaseMatch(methodName, method.selector)))
          continue next;
      }

      for (int i = methodsFound.size; --i >= 0;) {
        MethodBinding otherMethod = (MethodBinding) methodsFound.elementAt(i);
        if (method == otherMethod)
          continue next;

        if (CharOperation.equals(method.selector, otherMethod.selector, true)
            && lookupEnvironment.methodVerifier().doesMethodOverride(otherMethod, method)) {
          continue next;
        }
      }

      newMethodsFound.add(method);
     
      int length = method.parameters.length;
      char[][] parameterPackageNames = new char[length][];
      char[][] parameterFullTypeNames = new char[length][];
     
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.util.ObjectVector

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.