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

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


      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) {
      QualifiedTypeReference qtr = (QualifiedTypeReference) tr;
View Full Code Here


        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(';');
      }
View Full Code Here

    // Collapse the parameterized reference to its generic type
    if (onType instanceof ParameterizedSingleTypeReference) {
      ParameterizedSingleTypeReference pref = (ParameterizedSingleTypeReference) onType;
      long pos = (((long)pref.sourceStart) << 32) | pref.sourceEnd;
      onType = new SingleTypeReference(pref.token,pos);
    } else {
      ParameterizedQualifiedTypeReference pref = (ParameterizedQualifiedTypeReference) onType;
      long pos = (((long)pref.sourceStart) << 32) | pref.sourceEnd;
      onType = new QualifiedTypeReference(pref.tokens,new long[]{pos});
     
    }
   
    onTypeBinding = (ReferenceBinding)onType.getTypeBindingPublic(classScope);   
    if (!onTypeBinding.isValidBinding()) {
      classScope.problemReporter().invalidType(onType, onTypeBinding);
      ignoreFurtherInvestigation = true;
    }

    
    if (onTypeBinding.isRawType()) {
      onTypeBinding = ((RawTypeBinding)onTypeBinding).type;
    }
   
    int aliasCount = (typeVariableAliases==null?0:typeVariableAliases.size());
   
    // Cannot specify a parameterized target type for the ITD if the target
    // type is not generic.
    if (aliasCount!=0 && !onTypeBinding.isGenericType()) {
      scope.problemReporter().signalError(sourceStart,sourceEnd,
          "Type parameters can not be specified in the ITD target type - the target type "+onTypeBinding.debugName()+" is not generic.");
      ignoreFurtherInvestigation = true;
      return;
    }
   
    // Check they have supplied the right number of type parameters on the ITD target type
    if (aliasCount>0) {
      if (onTypeBinding.typeVariables().length != aliasCount) { // typeParameters.length) {   phantom contains the fake ones from the ontype, typeparameters will also include extra things if it is a generic method
        scope.problemReporter().signalError(sourceStart, sourceEnd,
          "Incorrect number of type parameters supplied.  The generic type "+onTypeBinding.debugName()+" has "+
          onTypeBinding.typeVariables().length+" type parameters, not "+aliasCount+".");
        ignoreFurtherInvestigation = true;
        return;
      }
    }
   
    // check if they used stupid names for type variables
    if (aliasCount>0) {
      for (int i = 0; i < aliasCount; i++) {
        String array_element = (String)typeVariableAliases.get(i);
        SingleTypeReference str = new SingleTypeReference(array_element.toCharArray(),0);
        TypeBinding tb = str.getTypeBindingPublic(classScope);
        if (tb!=null && !(tb instanceof ProblemReferenceBinding)) {// && !(tb instanceof TypeVariableBinding)) {
          scope.problemReporter().signalError(sourceStart,sourceEnd,
              "Intertype declarations can only be made on the generic type, not on a parameterized type. The name '"+
              array_element+"' cannot be used as a type parameter, since it refers to a real type.");
          ignoreFurtherInvestigation = true;
View Full Code Here

        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();
View Full Code Here

      char[][] tokens = qualifiedTypeReference.tokens;
      long[] positions = qualifiedTypeReference.sourcePositions;
      // QualifiedName
      annotation.setTypeName(setQualifiedNameNameAndSourceRanges(tokens, positions, typeReference));
    } else {
      SingleTypeReference singleTypeReference = (SingleTypeReference) typeReference;
      final SimpleName name = new SimpleName(this.ast);
      name.internalSetIdentifier(new String(singleTypeReference.token));
      int start = singleTypeReference.sourceStart;
      int end = singleTypeReference.sourceEnd;
      name.setSourceRange(start, end - start + 1);
View Full Code Here

      }
      return getTypeBinding(fieldRef.resolvedType);
    } else if (node instanceof FieldReference) {
      return getTypeBinding(((FieldReference) node).resolvedType);
    } else if (node instanceof SingleTypeReference) {
      SingleTypeReference singleTypeReference = (SingleTypeReference) node;
      org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding = singleTypeReference.resolvedType;
      if (binding != null) {
        return this.getTypeBinding(binding.leafComponentType());
      }
    } else if (node instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) {
View Full Code Here

      }
      return getVariableBinding(fieldRef.binding);
    } else if (node instanceof FieldReference) {
      return getVariableBinding(((FieldReference) node).binding);
    } else if (node instanceof SingleTypeReference) {
      SingleTypeReference singleTypeReference = (SingleTypeReference) node;
      org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding = singleTypeReference.resolvedType;
      if (binding != null) {
        if (!binding.isValidBinding() && node instanceof JavadocSingleTypeReference) {
          JavadocSingleTypeReference typeRef = (JavadocSingleTypeReference) node;
          if (typeRef.packageBinding != null) {
View Full Code Here

* smoothly down the line.
*/
private void convertTypeParametersToSingleTypeReferences() {
  for(int typeParameterIndex = 0; typeParameterIndex < genericsLengthStack[genericsLengthPtr]; typeParameterIndex++) {
    TypeParameter tp = (TypeParameter) genericsStack[genericsPtr - typeParameterIndex];
    SingleTypeReference str = new SingleTypeReference(tp.name,tp.declarationSourceStart);
    genericsStack[genericsPtr - typeParameterIndex] = str;
  }
}
View Full Code Here

  }

  private void ensureVoidReturnType(MethodDeclaration methodDeclaration) {
    boolean returnsVoid = true;
    if ((methodDeclaration.returnType instanceof SingleTypeReference)) {
      SingleTypeReference retType = (SingleTypeReference) methodDeclaration.returnType;
      if (!CharOperation.equals(voidType, retType.token)) {
        returnsVoid = false;
      }
    } else {
      returnsVoid = false;
View Full Code Here

    }

    boolean returnsVoid = false;
    boolean returnsBoolean = false;
    if ((methodDeclaration.returnType instanceof SingleTypeReference)) {
      SingleTypeReference retType = (SingleTypeReference) methodDeclaration.returnType;
      if (CharOperation.equals(voidType, retType.token))
        returnsVoid = true;
      if (CharOperation.equals(booleanType, retType.token))
        returnsBoolean = true;
    }
View Full Code Here

TOP

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

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.