Examples of ReferenceBinding


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

public int size() {
  return elementSize;
}
public String toString() {
  String s = ""; //$NON-NLS-1$
  ReferenceBinding type;
  for (int i = 0, length = valueTable.length; i < length; i++)
    if ((type = valueTable[i]) != null)
      s += type.toString() + "\n"; //$NON-NLS-1$
  return s;
}
View Full Code Here

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

  private String getInternalName() {
    if (this.innerTypeBinding != null) {
      return this.innerTypeBinding.getInternalName();
    }
    ReferenceBinding referenceBinding = getReferenceBinding();
    if (referenceBinding != null) {
      return new String(referenceBinding.compoundName[referenceBinding.compoundName.length - 1]);
    }
    return this.getTypeNameFrom(getType());
  }
View Full Code Here

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

  /* (non-Javadoc)
   * @see org.aspectj.org.eclipse.jdt.core.dom.ITypeBinding#getQualifiedName()
   */
  public String getQualifiedName() {
    ReferenceBinding referenceBinding = getReferenceBinding();
    if (referenceBinding != null) {
      StringBuffer buffer = new StringBuffer();
      char[] brackets = new char[this.dimensions * 2];
      for (int i = this.dimensions * 2 - 1; i >= 0; i -= 2) {
        brackets[i] = ']';
View Full Code Here

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

    return typeVariables;
  }

  private TypeVariable typeParameter2TypeVariable(TypeParameter typeParameter) {
    String name = new String(typeParameter.name);
    ReferenceBinding superclassBinding = typeParameter.binding.superclass;
    UnresolvedType superclass = UnresolvedType.forSignature(new String(superclassBinding.signature()));
    UnresolvedType[] superinterfaces = null;
    ReferenceBinding[] superInterfaceBindings = typeParameter.binding.superInterfaces;
    if (superInterfaceBindings != null) {
      superinterfaces = new UnresolvedType[superInterfaceBindings.length];
      for (int i = 0; i < superInterfaceBindings.length; i++) {
View Full Code Here

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

  private void makePublic(TypeBinding binding) {
    if (binding == null || !binding.isValidBinding())
      return; // has already produced an error
    if (binding instanceof ReferenceBinding) {
      ReferenceBinding rb = (ReferenceBinding) binding;
      if (!rb.isPublic())
        handler.notePrivilegedTypeAccess(rb, null); // ???
    } else if (binding instanceof ArrayBinding) {
      makePublic(((ArrayBinding) binding).leafComponentType);
    } else {
      return;
View Full Code Here

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

  public void ensureScopeSetup() {
    if (scopeSetup) return; // don't do it again
    MethodScope scope = this.scope;
   
    TypeReference ot = onType;
    ReferenceBinding rb = null;
   
    if (ot instanceof ParameterizedQualifiedTypeReference) { // pr132349
      ParameterizedQualifiedTypeReference pref = (ParameterizedQualifiedTypeReference) ot;
      if (pref.typeArguments!=null && pref.typeArguments.length!=0) {
        boolean usingNonTypeVariableInITD = false;
        // Check if any of them are not type variables
        for (int i = 0; i < pref.typeArguments.length; i++) {
          TypeReference[] refs = pref.typeArguments[i];
          for (int j = 0; refs!=null && j < refs.length; j++) {
            TypeBinding tb = refs[j].getTypeBindingPublic(scope.parent);
            if (!tb.isTypeVariable() && !(tb instanceof ProblemReferenceBinding)) {
              usingNonTypeVariableInITD = true;
            }
           
          }
        }
        if (usingNonTypeVariableInITD) {
          scope.problemReporter().signalError(sourceStart,sourceEnd,
            "Cannot make inter-type declarations on parameterized types");
          // to prevent disgusting cascading errors after this problem - lets null out what leads to them (pr105038)
          this.arguments=null;
          this.returnType=new SingleTypeReference(TypeReference.VOID,0L);
         
          this.ignoreFurtherInvestigation=true;
          ReferenceBinding closestMatch = null;
          rb = new ProblemReferenceBinding(ot.getParameterizedTypeName(),closestMatch,0);   
          onType=null;
        }
      }
   
    }

    // Work out the real base type
    if (ot instanceof ParameterizedSingleTypeReference) {
      ParameterizedSingleTypeReference pref = (ParameterizedSingleTypeReference) ot;
      long pos = (((long)pref.sourceStart) << 32) | pref.sourceEnd;
      ot = new SingleTypeReference(pref.token,pos);
    } else if (ot instanceof ParameterizedQualifiedTypeReference) {
      ParameterizedQualifiedTypeReference pref = (ParameterizedQualifiedTypeReference) ot;
      long pos = (((long)pref.sourceStart) << 32) | pref.sourceEnd;
      ot = new QualifiedTypeReference(pref.tokens,new long[]{pos});//SingleTypeReference(pref.Quatoken,pos);
    }
   
    // resolve it
    if (rb==null) {
      rb = (ReferenceBinding)ot.getTypeBindingPublic(scope.parent);
    }
   
    // pr203646 - if we have ended up with the raw type, get back to the underlying generic one.
    if (rb.isRawType() && rb.isMemberType()) {
      // if the real target type used a type variable alias then we can do this OK, but need to switch things around, we want the generic type
      rb = ((RawTypeBinding)rb).type;
    }
   
    if (rb instanceof TypeVariableBinding) {
      scope.problemReporter().signalError(sourceStart,sourceEnd,
            "Cannot make inter-type declarations on type variables, use an interface and declare parents");
      // to prevent disgusting cascading errors after this problem - lets null out what leads to them (pr105038)
      this.arguments=null;
      this.returnType=new SingleTypeReference(TypeReference.VOID,0L);
     
      this.ignoreFurtherInvestigation=true;
      ReferenceBinding closestMatch = null;
      if (((TypeVariableBinding)rb).firstBound!=null) {
        closestMatch = ((TypeVariableBinding)rb).firstBound.enclosingType();
      }
      rb = new ProblemReferenceBinding(rb.compoundName,closestMatch,0);
    }
View Full Code Here

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

        call.receiver = new ThisReference(call.receiver.sourceStart, call.receiver.sourceEnd);
        accessName = NameMangler.superDispatchMethod(factory.fromBinding(targetClass), new String(superBinding.selector))
            .toCharArray();
      } else if (call.receiver.isThis() && call.binding.isProtected() && !call.binding.isStatic()) {
        // XXX this is a hack that violates some binary compatibility rules
        ReferenceBinding superBindingDeclaringClass = superBinding.declaringClass;
        if (superBindingDeclaringClass.isParameterizedType()) {
          superBindingDeclaringClass = ((ParameterizedTypeBinding) superBindingDeclaringClass).type;
        }
        if (superBindingDeclaringClass.equals(targetClass)) {
          accessName = NameMangler.protectedDispatchMethod(factory.fromBinding(targetClass),
              new String(superBinding.selector)).toCharArray();
        } else {
          accessName = NameMangler.superDispatchMethod(factory.fromBinding(targetClass),
              new String(superBinding.selector)).toCharArray();
View Full Code Here

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

  // this method depends on the fact that BinaryTypeBinding extends SourceTypeBinding
  private SourceTypeBinding makeSourceTypeBinding(ReferenceBinding onType) {
    if (onType instanceof SourceTypeBinding)
      return (SourceTypeBinding) onType;
    else if (onType instanceof ParameterizedTypeBinding) {
      ReferenceBinding rb = ((ParameterizedTypeBinding) onType).type;
      if (rb instanceof SourceTypeBinding)
        return (SourceTypeBinding) rb;
      else
        throw new BCException("In parameterized type " + onType + ", can't handle reference binding " + rb);
    } else if (onType instanceof ProblemReferenceBinding) {
View Full Code Here

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

    if (isPublic())
      return true;

    SourceTypeBinding invocationType = scope.invocationType();
    // System.out.println("receiver: " + receiverType + ", " + invocationType);
    ReferenceBinding declaringType = declaringClass;

    // FIXME asc what about parameterized types and private ITD generic fields on interfaces?

    // Don't work with a raw type, work with the generic type
    if (declaringClass.isRawType())
      declaringType = ((RawTypeBinding) declaringClass).type;

    if (invocationType == declaringType)
      return true;

    // if (invocationType.isPrivileged) {
    // System.out.println("privileged access to: " + this);
    // return true;
    // }

    if (isProtected()) {
      throw new RuntimeException("unimplemented");
    }

    // XXX make sure this walks correctly
    if (isPrivate()) {
      // answer true if the receiverType is the declaringClass
      // AND the invocationType and the declaringClass have a common enclosingType

      // see pr149071 - it has caused me to comment out this block below - what
      // is it trying to achieve? Possibly it should be using the scope.parentScope (the class scope of
      // where the reference is being made) rather than the receiver type

      // Is the receiverType an innertype of the declaring type?
      // boolean receiverTypeIsSameOrInsideDeclaringType = receiverType == declaringType;
      // ReferenceBinding typeToCheckNext = receiverType.enclosingType();
      // while (!receiverTypeIsSameOrInsideDeclaringType && typeToCheckNext!=null) {
      // if (typeToCheckNext==declaringType) receiverTypeIsSameOrInsideDeclaringType=true;
      // }
      // if (!receiverTypeIsSameOrInsideDeclaringType) return false;

      // the code above replaces this line: (pr118698)
      // if (receiverType != declaringType) return false;

      if (invocationType != declaringType) {
        ReferenceBinding outerInvocationType = invocationType;
        ReferenceBinding temp = outerInvocationType.enclosingType();
        while (temp != null) {
          outerInvocationType = temp;
          temp = temp.enclosingType();
        }

        ReferenceBinding outerDeclaringClass = declaringType;
        temp = outerDeclaringClass.enclosingType();
        while (temp != null) {
          outerDeclaringClass = temp;
          temp = temp.enclosingType();
        }
        if (outerInvocationType != outerDeclaringClass)
View Full Code Here

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

   */
  private void weaveIntertypes(List<SourceTypeBinding> typesToProcess, SourceTypeBinding typeToWeave,
      List<ConcreteTypeMunger> typeMungers, List<DeclareParents> declareParents,
      List<DeclareAnnotation> declareAnnotationOnTypes, int mode) {
    // Look at the supertype first
    ReferenceBinding superType = typeToWeave.superclass();
    if (typesToProcess.contains(superType) && superType instanceof SourceTypeBinding) {
      // System.err.println("Recursing to supertype "+new
      // String(superType.getFileName()));
      weaveIntertypes(typesToProcess, (SourceTypeBinding) superType, typeMungers, declareParents, declareAnnotationOnTypes,
          mode);
    }
    // Then look at the superinterface list
    ReferenceBinding[] interfaceTypes = typeToWeave.superInterfaces();
    for (int i = 0; i < interfaceTypes.length; i++) {
      ReferenceBinding binding = interfaceTypes[i];
      if (typesToProcess.contains(binding) && binding instanceof SourceTypeBinding) {
        // System.err.println("Recursing to superinterface "+new
        // String(binding.getFileName()));
        weaveIntertypes(typesToProcess, (SourceTypeBinding) binding, typeMungers, declareParents, declareAnnotationOnTypes,
            mode);
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.