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

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


      }
    }
    /* rebuild identifiers and dimensions */
    if (identCount == 1) { // simple type reference
      if (dim == 0) {
        return new SingleTypeReference(type, 0);
      } else {
        char[] identifier = new char[dimStart];
        System.arraycopy(type, 0, identifier, 0, dimStart);
        return new ArrayTypeReference(identifier, dim, 0);
      }
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

  private void resolveTypeParametersForITDOnGenericType(ClassScope classScope) {

    // Collapse the parameterized reference to its generic type
    ParameterizedSingleTypeReference pref = (ParameterizedSingleTypeReference) onType;
    long pos = (((long)pref.sourceStart) << 32) | pref.sourceEnd;
    onType = new SingleTypeReference(pref.token,pos);
   
    onTypeBinding = (ReferenceBinding)onType.getTypeBindingPublic(classScope);   
    if (!onTypeBinding.isValidBinding()) {
      classScope.problemReporter().invalidType(onType, onTypeBinding);
      ignoreFurtherInvestigation = true;
    }
   
    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)) {
          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

   
    // 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);
    }

    // resolve it
    ReferenceBinding rb = (ReferenceBinding)ot.getTypeBindingPublic(scope.parent);

    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

  }

  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;
    }
    if (!returnsVoid && !containsIfPcd) {
      methodDeclaration.scope.problemReporter().signalError(methodDeclaration.returnType.sourceStart,
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

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.