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.BlockScope; 16 import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; 17 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; 18 19 public class SuperReference extends ThisReference { 20 21 public SuperReference(int sourceStart, int sourceEnd) { 22 23 super(sourceStart, sourceEnd); 24 } 25 26 public static ExplicitConstructorCall implicitSuperConstructorCall() { 27 28 return new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper); 29 } 30 31 public boolean isImplicitThis() { 32 33 return false; 34 } 35 36 public boolean isSuper() { 37 38 return true; 39 } 40 41 public boolean isThis() { 42 43 return false ; 44 } 45 46 public StringBuffer printExpression(int indent, StringBuffer output){ 47 48 return output.append("super"); 50 } 51 52 public TypeBinding resolveType(BlockScope scope) { 53 54 constant = Constant.NotAConstant; 55 if (!checkAccess(scope.methodScope())) 56 return null; 57 ReferenceBinding enclosingReceiverType = scope.enclosingReceiverType(); 58 if (enclosingReceiverType.id == T_JavaLangObject) { 59 scope.problemReporter().cannotUseSuperInJavaLangObject(this); 60 return null; 61 } 62 return this.resolvedType = enclosingReceiverType.superclass(); 63 } 64 65 public void traverse(ASTVisitor visitor, BlockScope blockScope) { 66 visitor.visit(this, blockScope); 67 visitor.endVisit(this, blockScope); 68 } 69 } 70 | Popular Tags |