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

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference


      }
    }
    /*
     * Superclass
     */
    final TypeReference superclass = typeDeclaration.superclass;
    if (superclass != null) {
      Alignment superclassAlignment =this.scribe.createAlignment(
          "superclass", //$NON-NLS-1$
          this.preferences.alignment_for_superclass_in_type_declaration,
          2,
          this.scribe.scanner.currentPosition);
      this.scribe.enterAlignment(superclassAlignment);
      boolean ok = false;
      do {
        try {
          this.scribe.alignFragment(superclassAlignment, 0);
          this.scribe.printNextToken(TerminalTokens.TokenNameextends, true);
          this.scribe.alignFragment(superclassAlignment, 1);
          this.scribe.space();
          superclass.traverse(this, typeDeclaration.scope);
          ok = true;
        } catch (AlignmentException e) {
          this.scribe.redoAlignment(e);
        }
      } while (!ok);
View Full Code Here


        this.scribe.printModifiers(annotationTypeMemberDeclaration.annotations, this);
    this.scribe.space();
    /*
     * Print the method return type
     */ 
    final TypeReference returnType = annotationTypeMemberDeclaration.returnType;
    final MethodScope annotationTypeMemberDeclarationScope = annotationTypeMemberDeclaration.scope;
   
    if (returnType != null) {
      returnType.traverse(this, annotationTypeMemberDeclarationScope);
    }
    /*
     * Print the method name
     */
    this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier, true);
View Full Code Here

    }
   
    /*
     * Print the method return type
     */ 
    final TypeReference returnType = methodDeclaration.returnType;
    final MethodScope methodDeclarationScope = methodDeclaration.scope;
   
    if (returnType != null) {
      returnType.traverse(this, methodDeclarationScope);
    }
    /*
     * Print the method name
     */
    this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier, true);
View Full Code Here

      handleSig.append('Q').append(pstr.token);
      TypeReference[] typeRefs = pstr.typeArguments;
      if (typeRefs != null && typeRefs.length > 0) {
        handleSig.append("\\<");
        for (int i = 0; i < typeRefs.length; i++) {
          TypeReference typeR = typeRefs[i];
          TypeBinding typeB = typeR.resolvedType;
          if (typeB == null) {
            typeB = typeR.resolveType(scope);
          }
          createHandleSigForReference(typeR, typeB, scope, handleSig);
        }
        handleSig.append('>');
      }
      handleSig.append(';');
    } else if (ref instanceof ArrayTypeReference) {
      ArrayTypeReference atr = (ArrayTypeReference) ref;
      for (int i = 0; i < atr.dimensions; i++) {
        handleSig.append("\\[");
      }
      TypeBinding typeB = atr.resolvedType;
      if (typeB == null) {
        typeB = atr.resolveType(scope);
      }
      if (typeB.leafComponentType().isBaseType()) {
        handleSig.append(tb.leafComponentType().signature());
      } else {
        handleSig.append('Q').append(atr.token).append(';');
      }
    } else if (ref instanceof SingleTypeReference) {
      SingleTypeReference str = (SingleTypeReference) ref;
      if (tb.isBaseType()) {
        handleSig.append(tb.signature());
      } else {
        handleSig.append('Q').append(str.token).append(';');
      }
    } else if (ref instanceof ParameterizedQualifiedTypeReference) {
      ParameterizedQualifiedTypeReference pstr = (ParameterizedQualifiedTypeReference) ref;
      char[][] tokens = pstr.tokens;
      for (int i = pstr.dimensions(); i > 0; i--) {
        handleSig.append("\\[");
      }
      handleSig.append('Q');
      for (int i = 0; i < tokens.length; i++) {
        if (i > 0) {
          handleSig.append('.');
        }
        handleSig.append(tokens[i]);
        TypeReference[] typeRefs = pstr.typeArguments[i];
        if (typeRefs != null && typeRefs.length > 0) {
          handleSig.append("\\<");
          for (int j = 0; j < typeRefs.length; j++) {
            TypeReference typeR = typeRefs[j];
            TypeBinding typeB = typeR.resolvedType;
            if (typeB == null) {
              typeB = typeR.resolveType(scope);
            }
            createHandleSigForReference(typeR, typeB, scope, handleSig);
          }
          handleSig.append('>');
        }
View Full Code Here

      boolean problemWithSourceRefs = false;
      for (int i = 0; i < argArray.length; i++) {
        String argName = new String(argArray[i].name);
        // String argType = "<UnknownType>"; // pr135052
        if (acceptArgument(argName, argArray[i].type.toString())) {
          TypeReference typeR = argArray[i].type;
          if (typeR != null && md.scope != null) {
            TypeBinding typeB = typeR.resolvedType;
            if (typeB == null) {
              typeB = typeR.resolveType(md.scope);
            }
            // This code will conjure up a 'P' style signature:
            // EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(md.scope);
            // UnresolvedType ut = factory.fromBinding(typeB);
            // paramSigs.add(ut.getSignature().toCharArray());
View Full Code Here

   */
  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
View Full Code Here

    simpleName.internalSetIdentifier(new String(typeParameter.name));
    int start = typeParameter.sourceStart;
    int end = typeParameter.sourceEnd;
    simpleName.setSourceRange(start, end - start + 1);
    typeParameter2.setName(simpleName);
    final TypeReference superType = typeParameter.type;
    end = typeParameter.declarationSourceEnd;
    if (superType != null) {
      Type type = convertType(superType);
      typeParameter2.typeBounds().add(type);
      end = type.getStartPosition() + type.getLength() - 1;
View Full Code Here

    return qualifiedName;
  }

  protected void setTypeNameForAnnotation(org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation compilerAnnotation,
      Annotation annotation) {
    TypeReference typeReference = compilerAnnotation.type;
    if (typeReference instanceof QualifiedTypeReference) {
      QualifiedTypeReference qualifiedTypeReference = (QualifiedTypeReference) typeReference;
      char[][] tokens = qualifiedTypeReference.tokens;
      long[] positions = qualifiedTypeReference.sourcePositions;
      // QualifiedName
View Full Code Here

           binding = typeBinding;
         } else {
          binding = typeBinding;
         }
            } else if (node instanceof TypeReference) {
        TypeReference typeReference = (TypeReference) node;
        binding = typeReference.resolvedType;
      } else if (node instanceof SingleNameReference && ((SingleNameReference)node).isTypeReference()) {
        binding = (((SingleNameReference)node).resolvedType);
      } else if (node instanceof QualifiedNameReference && ((QualifiedNameReference)node).isTypeReference()) {
        binding = (((QualifiedNameReference)node).resolvedType);
View Full Code Here

    char[][] typeName = CharOperation.splitOn('.', name.replace('$', '.').toCharArray()); // pr149293 - not bulletproof...
    long[] positions = new long[typeName.length];
    for (int i = 0; i < positions.length; i++) {
      positions[i] = pos;
    }
    TypeReference annType = new QualifiedTypeReference(typeName, positions);
    NormalAnnotation ann = new NormalAnnotation(annType, pos);
    ann.resolvedType = tb; // yuck - is this OK in all cases?
    // We don't need membervalues...
    // Expression pcExpr = new
    // StringLiteral(pointcutExpression.toCharArray(),pos,pos);
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference

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.