1 11 package org.eclipse.jdt.internal.compiler.ast; 12 13 import org.eclipse.jdt.internal.compiler.ASTVisitor; 14 import org.eclipse.jdt.internal.compiler.impl.Constant; 15 import org.eclipse.jdt.internal.compiler.lookup.Binding; 16 import org.eclipse.jdt.internal.compiler.lookup.BlockScope; 17 import org.eclipse.jdt.internal.compiler.lookup.ClassScope; 18 import org.eclipse.jdt.internal.compiler.lookup.PackageBinding; 19 import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; 20 import org.eclipse.jdt.internal.compiler.lookup.Scope; 21 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; 22 23 24 public class JavadocQualifiedTypeReference extends QualifiedTypeReference { 25 26 public int tagSourceStart, tagSourceEnd; 27 public PackageBinding packageBinding; 28 29 public JavadocQualifiedTypeReference(char[][] sources, long[] pos, int tagStart, int tagEnd) { 30 super(sources, pos); 31 this.tagSourceStart = tagStart; 32 this.tagSourceEnd = tagEnd; 33 this.bits |= ASTNode.InsideJavadoc; 34 } 35 36 protected void reportInvalidType(Scope scope) { 37 scope.problemReporter().javadocInvalidType(this, this.resolvedType, scope.getDeclarationModifiers()); 38 } 39 protected void reportDeprecatedType(TypeBinding type, Scope scope) { 40 scope.problemReporter().javadocDeprecatedType(type, this, scope.getDeclarationModifiers()); 41 } 42 43 47 public void traverse(ASTVisitor visitor, BlockScope scope) { 48 visitor.visit(this, scope); 49 visitor.endVisit(this, scope); 50 } 51 public void traverse(ASTVisitor visitor, ClassScope scope) { 52 visitor.visit(this, scope); 53 visitor.endVisit(this, scope); 54 } 55 56 59 private TypeBinding internalResolveType(Scope scope, boolean checkBounds) { 60 this.constant = Constant.NotAConstant; 62 if (this.resolvedType != null) return this.resolvedType.isValidBinding() ? this.resolvedType : null; 65 this.resolvedType = getTypeBinding(scope); 66 if (!this.resolvedType.isValidBinding()) { 67 Binding binding = scope.getTypeOrPackage(this.tokens); 68 if (binding instanceof PackageBinding) { 69 this.packageBinding = (PackageBinding) binding; 70 } else { 71 reportInvalidType(scope); 72 } 73 return null; 74 } 75 if (isTypeUseDeprecated(this.resolvedType, scope)) 76 reportDeprecatedType(this.resolvedType, scope); 77 if (this.resolvedType instanceof ParameterizedTypeBinding) { 78 this.resolvedType = ((ParameterizedTypeBinding)this.resolvedType).genericType(); 79 } 80 return this.resolvedType; 81 } 82 83 public TypeBinding resolveType(BlockScope blockScope, boolean checkBounds) { 84 return internalResolveType(blockScope, checkBounds); 85 } 86 87 public TypeBinding resolveType(ClassScope classScope) { 88 return internalResolveType(classScope, false); 89 } 90 } 91 | Popular Tags |