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

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


    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.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

    char[][] expectedTypekeys= this.completionContext.getExpectedTypesKeys();
    if (expectedTypekeys == null || expectedTypekeys.length == 0)
      return true;
    // Next, find out whether any of the constructor parameters are the same as one of the
    // class type variables. If yes, diamond cannot be used.
    TypeReference ref;
    if (cn.length == 1) {
      ref = new SingleTypeReference(cn[0], 0);
    } else {
      ref = new QualifiedTypeReference(cn,new long[cn.length]);
    }
    switch (scope.kind) {
      case Scope.METHOD_SCOPE :
      case Scope.BLOCK_SCOPE :
        guessedType = ref.resolveType((BlockScope)scope);
        break;
      case Scope.CLASS_SCOPE :
        guessedType = ref.resolveType((ClassScope)scope);
        break;
    }
    if (guessedType != null && guessedType.isValidBinding()) {
      // the erasure must be used because guessedType can be a RawTypeBinding
      guessedType = guessedType.erasure();
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

  }
  if ((this.tagBits & TagBits.HierarchyHasProblems) == 0) {
    return this.superclass;
  }
  if (this.scope != null) {
    TypeReference typeReference = this.scope.referenceContext.allocation.type;
    if (typeReference != null) {
      return (ReferenceBinding) typeReference.resolvedType;
    }
  }
  return this.superclass; // default answer
View Full Code Here

    }
  }
  return interfaceNames;
}
protected char[] getSuperclassName(TypeDeclaration typeDeclaration) {
  TypeReference superclass = typeDeclaration.superclass;
  return superclass != null ? CharOperation.concatWith(superclass.getParameterizedTypeName(), '.') : null;
}
View Full Code Here

    }
  }
  return thrownExceptionTypes;
}
protected char[][] getTypeParameterBounds(TypeParameter typeParameter) {
  TypeReference firstBound = typeParameter.type;
  TypeReference[] otherBounds = typeParameter.bounds;
  char[][] typeParameterBounds = null;
  if (firstBound != null) {
    if (otherBounds != null) {
      int otherBoundsLength = otherBounds.length;
      char[][] boundNames = new char[otherBoundsLength+1][];
      boundNames[0] = CharOperation.concatWith(firstBound.getParameterizedTypeName(), '.');
      for (int j = 0; j < otherBoundsLength; j++) {
        boundNames[j+1] =
          CharOperation.concatWith(otherBounds[j].getParameterizedTypeName(), '.');
      }
      typeParameterBounds = boundNames;
    } else {
      typeParameterBounds = new char[][] { CharOperation.concatWith(firstBound.getParameterizedTypeName(), '.')};
    }
  } else {
    typeParameterBounds = CharOperation.NO_CHAR_CHAR;
  }
View Full Code Here

      currentModifiers |= ClassFileConstants.AccVarargs;

    // remember deprecation so as to not lose it below
    boolean deprecated = (currentModifiers & ClassFileConstants.AccDeprecated) != 0 || hasDeprecatedAnnotation(methodDeclaration.annotations);

    TypeReference returnType = methodDeclaration instanceof MethodDeclaration
      ? ((MethodDeclaration) methodDeclaration).returnType
      : null;
    ISourceElementRequestor.MethodInfo methodInfo = new ISourceElementRequestor.MethodInfo();
    methodInfo.isAnnotation = methodDeclaration instanceof AnnotationMethodDeclaration;
    methodInfo.declarationStart = methodDeclaration.declarationSourceStart;
    methodInfo.modifiers = deprecated ? (currentModifiers & ExtraCompilerModifiers.AccJustFlag) | ClassFileConstants.AccDeprecated : currentModifiers & ExtraCompilerModifiers.AccJustFlag;
    methodInfo.returnType = returnType == null ? null : CharOperation.concatWith(returnType.getParameterizedTypeName(), '.');
    methodInfo.name = methodDeclaration.selector;
    methodInfo.nameSourceStart = methodDeclaration.sourceStart;
    methodInfo.nameSourceEnd = selectorSourceEnd;
    methodInfo.parameterTypes = argumentTypes;
    methodInfo.parameterNames = argumentNames;
View Full Code Here

  int catchBlock = this.exceptionToCatchBlockMap[index];
  ASTNode node = this.catchArguments[catchBlock].type;
  if (node instanceof UnionTypeReference) {
    TypeReference[] typeRefs = ((UnionTypeReference)node).typeReferences;
    for (int i = 0, len = typeRefs.length; i < len; i++) {
      TypeReference typeRef = typeRefs[i];
      if (typeRef.resolvedType == this.handledExceptions[index]) return typeRef;
   
  }
  return node;
}
View Full Code Here

      }
    }
    /*
     * Superclass
     */
    final TypeReference superclass = typeDeclaration.superclass;
    if (superclass != null) {
      Alignment superclassAlignment =this.scribe.createAlignment(
          Alignment.SUPER_CLASS,
          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

TOP

Related Classes of 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.