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

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


    LocalTypeBinding anonymousType = buildLocalType(enclosingType, supertype, enclosingType.fPackage);
    anonymousType.modifiers |= ExtraCompilerModifiers.AccLocallyUsed; // tag all anonymous types as used locally
    if (supertype.isInterface()) {
      anonymousType.superclass = getJavaLangObject();
      anonymousType.superInterfaces = new ReferenceBinding[] { supertype };
      TypeReference typeReference = this.referenceContext.allocation.type;
      if (typeReference != null) {
        if ((supertype.tagBits & TagBits.HasDirectWildcard) != 0) {
          problemReporter().superTypeCannotUseWildcard(anonymousType, typeReference, supertype);
          anonymousType.tagBits |= TagBits.HierarchyHasProblems;
          anonymousType.superInterfaces = Binding.NO_SUPERINTERFACES;
        }
      }
    } else {
      anonymousType.superclass = supertype;
      anonymousType.superInterfaces = Binding.NO_SUPERINTERFACES;
      TypeReference typeReference = this.referenceContext.allocation.type;
      if (typeReference != null) { // no check for enum constant body
        if (supertype.erasure().id == TypeIds.T_JavaLangEnum) {
          problemReporter().cannotExtendEnum(anonymousType, typeReference, supertype);
          anonymousType.tagBits |= TagBits.HierarchyHasProblems;
          anonymousType.superclass = getJavaLangObject();
View Full Code Here


      TypeReference[] boundRefs = typeParameter.bounds;
      if (boundRefs != null) {
        boolean checkSuperclass = typeVariable.firstBound == typeVariable.superclass;
        for (int j = 0, boundLength = boundRefs.length; j < boundLength; j++) {
          TypeReference typeRef = boundRefs[j];
          TypeBinding superType = typeRef.resolvedType;
          if (superType == null || !superType.isValidBinding()) continue;

          // check against superclass
          if (checkSuperclass)
View Full Code Here

      if (sourceType.isEnum() && compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) // do not connect if source < 1.5 as enum already got flagged as syntax error
        return connectEnumSuperclass();
      sourceType.superclass = getJavaLangObject();
      return !detectHierarchyCycle(sourceType, sourceType.superclass, null);
    }
    TypeReference superclassRef = this.referenceContext.superclass;
    ReferenceBinding superclass = findSupertype(superclassRef);
    if (superclass != null) { // is null if a cycle was detected cycle or a problem
      if (!superclass.isClass() && (superclass.tagBits & TagBits.HasMissingType) == 0) {
        problemReporter().superclassMustBeAClass(sourceType, superclassRef, superclass);
      } else if (superclass.isFinal()) {
View Full Code Here

    boolean noProblems = true;
    int length = this.referenceContext.superInterfaces.length;
    ReferenceBinding[] interfaceBindings = new ReferenceBinding[length];
    int count = 0;
    nextInterface : for (int i = 0; i < length; i++) {
        TypeReference superInterfaceRef = this.referenceContext.superInterfaces[i];
      ReferenceBinding superInterface = findSupertype(superInterfaceRef);
      if (superInterface == null) { // detected cycle
        sourceType.tagBits |= TagBits.HierarchyHasProblems;
        noProblems = false;
        continue nextInterface;
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

    }
  }

  boolean foundReturnTypeProblem = false;
  if (!method.isConstructor()) {
    TypeReference returnType = methodDecl instanceof MethodDeclaration
      ? ((MethodDeclaration) methodDecl).returnType
      : null;
    if (returnType == null) {
      methodDecl.scope.problemReporter().missingReturnType(methodDecl);
      method.returnType = null;
      foundReturnTypeProblem = true;
    } else {
      TypeBinding methodType = returnType.resolveType(methodDecl.scope, true /* check bounds*/);
      if (methodType == null) {
        foundReturnTypeProblem = true;
      } else if (methodType.isArrayType() && ((ArrayBinding) methodType).leafComponentType == TypeBinding.VOID) {
        methodDecl.scope.problemReporter().returnTypeCannotBeVoidArray((MethodDeclaration) methodDecl);
        foundReturnTypeProblem = true;
View Full Code Here

    }
  } else if (method.isConstructor()){
    sourceStart = method.sourceStart;
    sourceEnd = method.sourceEnd;
  } else {
    TypeReference returnType = ((MethodDeclaration) method).returnType;
    sourceStart = returnType.sourceStart;
    if (returnType instanceof ParameterizedSingleTypeReference) {
      ParameterizedSingleTypeReference typeReference = (ParameterizedSingleTypeReference) returnType;
      TypeReference[] typeArguments = typeReference.typeArguments;
      if (typeArguments[typeArguments.length - 1].sourceEnd > typeReference.sourceEnd) {
View Full Code Here

}
public void wrongSequenceOfExceptionTypesError(TryStatement statement, TypeBinding exceptionType, int under, TypeBinding hidingExceptionType) {
  //the two catch block under and upper are in an incorrect order.
  //under should be define BEFORE upper in the source

  TypeReference typeRef = statement.catchArguments[under].type;
  this.handle(
    IProblem.InvalidCatchBlockSequence,
    new String[] {
      new String(exceptionType.readableName()),
      new String(hidingExceptionType.readableName()),
View Full Code Here

    }
    anonymousType.typeBits |= inheritedBits;
    if (supertype.isInterface()) {
      anonymousType.superclass = getJavaLangObject();
      anonymousType.superInterfaces = new ReferenceBinding[] { supertype };
      TypeReference typeReference = this.referenceContext.allocation.type;
      if (typeReference != null) {
        if ((supertype.tagBits & TagBits.HasDirectWildcard) != 0) {
          problemReporter().superTypeCannotUseWildcard(anonymousType, typeReference, supertype);
          anonymousType.tagBits |= TagBits.HierarchyHasProblems;
          anonymousType.superInterfaces = Binding.NO_SUPERINTERFACES;
        }
      }
    } else {
      anonymousType.superclass = supertype;
      anonymousType.superInterfaces = Binding.NO_SUPERINTERFACES;
      TypeReference typeReference = this.referenceContext.allocation.type;
      if (typeReference != null) { // no check for enum constant body
        if (supertype.erasure().id == TypeIds.T_JavaLangEnum) {
          problemReporter().cannotExtendEnum(anonymousType, typeReference, supertype);
          anonymousType.tagBits |= TagBits.HierarchyHasProblems;
          anonymousType.superclass = getJavaLangObject();
View Full Code Here

      TypeReference[] boundRefs = typeParameter.bounds;
      if (boundRefs != null) {
        boolean checkSuperclass = typeVariable.firstBound == typeVariable.superclass;
        for (int j = 0, boundLength = boundRefs.length; j < boundLength; j++) {
          TypeReference typeRef = boundRefs[j];
          TypeBinding superType = typeRef.resolvedType;
          if (superType == null || !superType.isValidBinding()) continue;

          // check against superclass
          if (checkSuperclass)
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.TypeReference$AnnotationCollector

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.