01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.compiler.ast;
11:
12: import org.eclipse.jdt.internal.compiler.ASTVisitor;
13: import org.eclipse.jdt.internal.compiler.impl.Constant;
14: import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
15: import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
16: import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
17:
18: public class SuperReference extends ThisReference {
19:
20: public SuperReference(int sourceStart, int sourceEnd) {
21:
22: super (sourceStart, sourceEnd);
23: }
24:
25: public static ExplicitConstructorCall implicitSuperConstructorCall() {
26:
27: return new ExplicitConstructorCall(
28: 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"); //$NON-NLS-1$
49:
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
58: .enclosingReceiverType();
59: if (enclosingReceiverType.id == T_JavaLangObject) {
60: scope.problemReporter()
61: .cannotUseSuperInJavaLangObject(this );
62: return null;
63: }
64: return this .resolvedType = enclosingReceiverType.super class();
65: }
66:
67: public void traverse(ASTVisitor visitor, BlockScope blockScope) {
68: visitor.visit(this, blockScope);
69: visitor.endVisit(this, blockScope);
70: }
71: }
|