1 /******************************************************************************* 2 * Copyright (c) 2000, 2004 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Common Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/cpl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.jdt.internal.compiler.ast; 12 13 import org.eclipse.jdt.internal.compiler.ASTVisitor; 14 import org.eclipse.jdt.internal.compiler.lookup.*; 15 16 public class QualifiedSuperReference extends QualifiedThisReference { 17 QualifiedSuperReference(TypeReference name, int pos, int sourceEnd)18 public QualifiedSuperReference(TypeReference name, int pos, int sourceEnd) { 19 super(name, pos, sourceEnd); 20 } 21 isSuper()22 public boolean isSuper() { 23 24 return true; 25 } 26 isThis()27 public boolean isThis() { 28 29 return false; 30 } 31 printExpression(int indent, StringBuffer output)32 public StringBuffer printExpression(int indent, StringBuffer output) { 33 34 return qualification.print(0, output).append(".super"); //$NON-NLS-1$ 35 } 36 resolveType(BlockScope scope)37 public TypeBinding resolveType(BlockScope scope) { 38 39 if ((this.bits & ParenthesizedMASK) != 0) { 40 scope.problemReporter().invalidParenthesizedExpression(this); 41 return null; 42 } 43 super.resolveType(scope); 44 if (currentCompatibleType == null) 45 return null; // error case 46 47 if (currentCompatibleType.id == T_Object) { 48 scope.problemReporter().cannotUseSuperInJavaLangObject(this); 49 return null; 50 } 51 return this.resolvedType = currentCompatibleType.superclass(); 52 } 53 traverse( ASTVisitor visitor, BlockScope blockScope)54 public void traverse( 55 ASTVisitor visitor, 56 BlockScope blockScope) { 57 58 if (visitor.visit(this, blockScope)) { 59 qualification.traverse(visitor, blockScope); 60 } 61 visitor.endVisit(this, blockScope); 62 } 63 } 64