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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.ast;
13 import org.eclipse.jdt.internal.compiler.ASTVisitor;
14 import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
15 import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
16 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
18 public class SuperReference extends ThisReference {
20 public SuperReference(int sourceStart, int sourceEnd) {
22 super(sourceStart, sourceEnd);
25 public static ExplicitConstructorCall implicitSuperConstructorCall() {
27 return new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);
30 public boolean isImplicitThis() {
35 public boolean isSuper() {
40 public boolean isThis() {
45 public StringBuffer printExpression(int indent, StringBuffer output){
47 return output.append("super"); //$NON-NLS-1$
51 public TypeBinding resolveType(BlockScope scope) {
53 constant = NotAConstant;
54 if (!checkAccess(scope.methodScope()))
56 SourceTypeBinding enclosingTb = scope.enclosingSourceType();
57 if (enclosingTb.id == T_Object) {
58 scope.problemReporter().cannotUseSuperInJavaLangObject(this);
61 return this.resolvedType = enclosingTb.superclass;
64 public void traverse(ASTVisitor visitor, BlockScope blockScope) {
65 visitor.visit(this, blockScope);
66 visitor.endVisit(this, blockScope);