Examples of ReferenceBinding


Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

  }

  private void removeCaughtException(ReferenceBinding caughtException) {
    Object[] exceptions = this.thrownExceptions.values;
    for (int i = 0; i < exceptions.length; i++) {
      ReferenceBinding exception = (ReferenceBinding)exceptions[i];
      if (exception != null) {
        if (exception == caughtException || caughtException.isSuperclassOf(exception)) {
          this.thrownExceptions.remove(exception);
        }
      }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

    if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
      ReferenceBinding[] interfacesToVisit = itsInterfaces;
      int nextPosition = interfacesToVisit.length;

      for (int i = 0; i < nextPosition; i++) {
        ReferenceBinding currentType = interfacesToVisit[i];
        MethodBinding[] methods = currentType.getMethods(methodBinding.selector);
        if(methods != null) {
          for (int k = 0; k < methods.length; k++) {
            if(methodBinding.areParametersEqual(methods[k]))
              return methods[k];
          }
        }

        if ((itsInterfaces = currentType.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++) {
            ReferenceBinding next = itsInterfaces[a];
            for (int b = 0; b < nextPosition; b++)
              if (next == interfacesToVisit[b]) continue nextInterface;
            interfacesToVisit[nextPosition++] = next;
          }
        }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

            compileTimeTypeID = boxedID;
            scope.problemReporter().autoboxing(collection, collectionElementType, elementType);
          }
        }
      } else if (collectionType instanceof ReferenceBinding) {
          ReferenceBinding iterableType = ((ReferenceBinding)collectionType).findSuperTypeErasingTo(T_JavaLangIterable, false /*Iterable is not a class*/);
          checkIterable: {
            if (iterableType == null) break checkIterable;
           
          this.iteratorReceiverType = collectionType.erasure();
          if (((ReferenceBinding)iteratorReceiverType).findSuperTypeErasingTo(T_JavaLangIterable, false) == null) {
            this.iteratorReceiverType = iterableType; // handle indirect inheritance thru variable secondary bound
               this.collection.computeConversion(scope, iterableType, collectionType);
          } else {
               this.collection.computeConversion(scope, collectionType, collectionType);
          }

            TypeBinding[] arguments = null;
            switch (iterableType.kind()) {
              case Binding.RAW_TYPE : // for(Object o : Iterable)
              this.kind = RAW_ITERABLE;
              this.collectionElementType = scope.getJavaLangObject();
              if (!collectionElementType.isCompatibleWith(elementType)
                  && !scope.isBoxingCompatibleWith(collectionElementType, elementType)) {
                scope.problemReporter().notCompatibleTypesErrorInForeach(collection, collectionElementType, elementType);
              }
              // no conversion needed as only for reference types
                break checkIterable;
               
              case Binding.GENERIC_TYPE : // for (T t : Iterable<T>) - in case used inside Iterable itself
                arguments = iterableType.typeVariables();
                break;
               
              case Binding.PARAMETERIZED_TYPE : // for(E e : Iterable<E>)
                arguments = ((ParameterizedTypeBinding)iterableType).arguments;
                break;
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

      if ((caughtExceptions = exceptionContext.handledExceptions) != Binding.NO_EXCEPTIONS) {
        boolean definitelyCaught = false;
        for (int caughtIndex = 0, caughtCount = caughtExceptions.length;
          caughtIndex < caughtCount;
          caughtIndex++) {
          ReferenceBinding caughtException = caughtExceptions[caughtIndex];
            int state = caughtException == null
              ? Scope.EQUAL_OR_MORE_SPECIFIC /* any exception */
                : Scope.compareTypes(raisedException, caughtException);           
          switch (state) {
            case Scope.EQUAL_OR_MORE_SPECIFIC :
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

      if ((caughtExceptions = exceptionContext.handledExceptions) != Binding.NO_EXCEPTIONS) {
        int caughtCount = caughtExceptions.length;
        boolean[] locallyCaught = new boolean[raisedCount]; // at most

        for (int caughtIndex = 0; caughtIndex < caughtCount; caughtIndex++) {
          ReferenceBinding caughtException = caughtExceptions[caughtIndex];
          for (int raisedIndex = 0; raisedIndex < raisedCount; raisedIndex++) {
            TypeBinding raisedException;
            if ((raisedException = raisedExceptions[raisedIndex]) != null) {
                int state = caughtException == null
                  ? Scope.EQUAL_OR_MORE_SPECIFIC /* any exception */
 
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

        printTypeReference(w.bound);
      }
      return output;
    } else if (tr instanceof ParameterizedSingleTypeReference) {
      ParameterizedSingleTypeReference pstr = (ParameterizedSingleTypeReference) tr;
      ReferenceBinding tb = (ReferenceBinding) mscope.getType(pstr.token);
      output.append(CharOperation.concatWith(tb.compoundName, '.'));
      output.append('<');
      TypeReference[] typeArguments = pstr.typeArguments;
      for (int i = 0; i < typeArguments.length; i++) {
        if (i > 0) {
          output.append(',');
        }
        printTypeReference(typeArguments[i]);
      }
      output.append('>');
      for (int i = 0; i < pstr.dimensions; i++) {
        output.append("[]"); //$NON-NLS-1$
      }
      return output;
    } else if (tr instanceof ParameterizedQualifiedTypeReference) {
      ParameterizedQualifiedTypeReference pqtr = (ParameterizedQualifiedTypeReference) tr;
      output.append(CharOperation.concatWith(pqtr.tokens, '.'));
      output.append('<');
      TypeReference[][] typeArguments = pqtr.typeArguments;
      // TODO don't support parameterized interim name components
      TypeReference[] ofInterest = typeArguments[typeArguments.length - 1];
      for (int i = 0; i < ofInterest.length; i++) {
        if (i > 0) {
          output.append(',');
        }
        printTypeReference(ofInterest[i]);
      }
      output.append('>');
      for (int i = 0; i < pqtr.dimensions(); i++) {
        output.append("[]"); //$NON-NLS-1$
      }
      return output;
    } else if (tr instanceof SingleTypeReference) {
      SingleTypeReference str = (SingleTypeReference) tr;
      TypeBinding tb = mscope.getType(str.token);
      output.append(tb.debugName()); // fq name
      for (int i = 0; i < str.dimensions(); i++) {
        output.append("[]"); //$NON-NLS-1$
      }
      return output;
    } else if (tr instanceof QualifiedTypeReference) {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

        } else if (snr.binding instanceof LocalVariableBinding) {
          LocalVariableBinding lvb = (LocalVariableBinding) snr.binding;
          output.append(lvb.name);
        } else if (snr.binding instanceof FieldBinding) {
          FieldBinding fb = (FieldBinding) snr.binding;
          ReferenceBinding rb = fb.declaringClass;
          if (fb.isStatic()) {
            // qualify it
            output.append(CharOperation.concatWith(rb.compoundName, '.'));
            output.append('.');
            output.append(fb.name);
          } else {
            output.append(snr.token);
          }
          int stop = 1;
        } else {
          throwit(snr.binding);
        }
        return output;
      } else if (e instanceof QualifiedNameReference) {
        QualifiedNameReference qnr = (QualifiedNameReference) e;
        if (qnr.binding instanceof FieldBinding) {
          FieldBinding fb = (FieldBinding) qnr.binding;
          ReferenceBinding rb = fb.declaringClass;
          if (fb.isStatic()) {
            output.append(CharOperation.concatWith(rb.compoundName, '.'));
            output.append('.');
            output.append(fb.name);
          } else {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

    int length = substituedTypeNodes.length;
   
    for (int i = 0; i < length; i++) {
      TypeReference substituedType = substituedTypeNodes[i];
      if (substituedType.resolvedType == null) return false;
      ReferenceBinding erasure = (ReferenceBinding)substituedType.resolvedType.leafComponentType().erasure();
      Binding missingElement;
      int depthToRemove = originalTypeNames[i].length - 1 ;
      if (depthToRemove == 0) {
        missingElement = erasure;
      } else {
        int depth = erasure.depth() + 1;
       
        if (depth > depthToRemove) {
          missingElement = erasure.enclosingTypeAt(depthToRemove);
        } else {
          return false;
          ///////////////////////////////////////////////////////////
          //// Uncomment the following code to return missing package
          ///////////////////////////////////////////////////////////
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

    if (CharOperation.equals(fieldName, LENGTH))
      return ArrayBinding.ArrayLength;
    return null;
  }

  ReferenceBinding currentType = (ReferenceBinding) receiverType;
  if (!currentType.canBeSeenBy(this))
    return new ProblemFieldBinding(currentType, fieldName, ProblemReasons.ReceiverTypeNotVisible);

  FieldBinding field = currentType.getField(fieldName, true /*resolve*/);
  if (field != null) {
    if (canBeSeenByForCodeSnippet(field, currentType, invocationSite, this))
      return field;
    else
      return new ProblemFieldBinding(field /* closest match*/, field.declaringClass, fieldName, ProblemReasons.NotVisible);
  }

  // collect all superinterfaces of receiverType until the field is found in a supertype
  ReferenceBinding[][] interfacesToVisit = null;
  int lastPosition = -1;
  FieldBinding visibleField = null;
  boolean keepLooking = true;
  boolean notVisible = false; // we could hold onto the not visible field for extra error reporting
  while (keepLooking) {
    ReferenceBinding[] itsInterfaces = currentType.superInterfaces();
    if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
      if (interfacesToVisit == null)
        interfacesToVisit = new ReferenceBinding[5][];
      if (++lastPosition == interfacesToVisit.length)
        System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[lastPosition * 2][], 0, lastPosition);
      interfacesToVisit[lastPosition] = itsInterfaces;
    }
    if ((currentType = currentType.superclass()) == null)
      break;

    if ((field = currentType.getField(fieldName, true /*resolve*/)) != null) {
      keepLooking = false;
      if (canBeSeenByForCodeSnippet(field, receiverType, invocationSite, this)) {
        if (visibleField == null)
          visibleField = field;
        else
          return new ProblemFieldBinding(visibleField, visibleField.declaringClass, fieldName, ProblemReasons.Ambiguous);
      } else {
        notVisible = true;
      }
    }
  }

  // walk all visible interfaces to find ambiguous references
  if (interfacesToVisit != null) {
    ProblemFieldBinding ambiguous = null;
    org.aspectj.org.eclipse.jdt.internal.compiler.util.SimpleSet interfacesSeen = new org.aspectj.org.eclipse.jdt.internal.compiler.util.SimpleSet(lastPosition * 2);
    done : for (int i = 0; i <= lastPosition; i++) {
      ReferenceBinding[] interfaces = interfacesToVisit[i];
      for (int j = 0, length = interfaces.length; j < length; j++) {
        ReferenceBinding anInterface = interfaces[j];
        if (interfacesSeen.addIfNotIncluded(anInterface) == anInterface) {
          // if interface as not already been visited
          if ((field = anInterface.getField(fieldName, true /*resolve*/)) != null) {
            if (visibleField == null) {
              visibleField = field;
            } else {
              ambiguous = new ProblemFieldBinding(visibleField, visibleField.declaringClass, fieldName, ProblemReasons.Ambiguous);
              break done;
            }
          } else {
            ReferenceBinding[] itsInterfaces = anInterface.superInterfaces();
            if (itsInterfaces != Binding.NO_SUPERINTERFACES) {
              if (++lastPosition == interfacesToVisit.length)
                System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[lastPosition * 2][], 0, lastPosition);
              interfacesToVisit[lastPosition] = itsInterfaces;
            }
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding

  return methodBinding;
}

// Internal use only
public MethodBinding findMethodForArray(ArrayBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) {
  ReferenceBinding object = getJavaLangObject();
  MethodBinding methodBinding = object.getExactMethod(selector, argumentTypes, null);
  if (methodBinding != null) {
    // handle the method clone() specially... cannot be protected or throw exceptions
    if (argumentTypes == Binding.NO_PARAMETERS && CharOperation.equals(selector, CLONE))
      return new MethodBinding((methodBinding.modifiers & ~ClassFileConstants.AccProtected) | ClassFileConstants.AccPublic, CLONE, methodBinding.returnType, argumentTypes, null, object);
    if (canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this))
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.