KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > ast > QualifiedSuperReference


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-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     
18     public QualifiedSuperReference(TypeReference name, int pos, int sourceEnd) {
19         super(name, pos, sourceEnd);
20     }
21
22     public boolean isSuper() {
23
24         return true;
25     }
26
27     public boolean isThis() {
28
29         return false;
30     }
31
32     public StringBuffer JavaDoc printExpression(int indent, StringBuffer JavaDoc output) {
33
34         return qualification.print(0, output).append(".super"); //$NON-NLS-1$
35
}
36     
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_JavaLangObject) {
48             scope.problemReporter().cannotUseSuperInJavaLangObject(this);
49             return null;
50         }
51         return this.resolvedType = currentCompatibleType.superclass();
52     }
53
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     public void traverse(
64             ASTVisitor visitor,
65             ClassScope blockScope) {
66
67         if (visitor.visit(this, blockScope)) {
68             qualification.traverse(visitor, blockScope);
69         }
70         visitor.endVisit(this, blockScope);
71     }
72 }
73
Popular Tags