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.*;
16 public class SingleTypeReference extends TypeReference {
20 public SingleTypeReference(char[] source, long pos) {
23 sourceStart = (int) (pos>>>32) ;
24 sourceEnd = (int) (pos & 0x00000000FFFFFFFFL) ;
28 public TypeReference copyDims(int dim){
29 //return a type reference copy of me with some dimensions
30 //warning : the new type ref has a null binding
32 return new ArrayTypeReference(token, dim,(((long)sourceStart)<<32)+sourceEnd);
35 protected TypeBinding getTypeBinding(Scope scope) {
36 if (this.resolvedType != null)
37 return this.resolvedType;
39 this.resolvedType = scope.getType(token);
41 if (scope.kind == Scope.CLASS_SCOPE && this.resolvedType.isValidBinding())
42 if (((ClassScope) scope).detectHierarchyCycle(this.resolvedType, this, null))
44 return this.resolvedType;
47 public char [][] getTypeName() {
48 return new char[][] { token };
51 public StringBuffer printExpression(int indent, StringBuffer output){
53 return output.append(token);
56 public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
58 ReferenceBinding memberType = scope.getMemberType(token, enclosingType);
59 if (!memberType.isValidBinding()) {
60 this.resolvedType = memberType;
61 scope.problemReporter().invalidEnclosingType(this, memberType, enclosingType);
64 if (isTypeUseDeprecated(memberType, scope))
65 scope.problemReporter().deprecatedType(memberType, this);
66 return this.resolvedType = scope.convertToRawType(memberType);
69 public void traverse(ASTVisitor visitor, BlockScope scope) {
70 visitor.visit(this, scope);
71 visitor.endVisit(this, scope);
74 public void traverse(ASTVisitor visitor, ClassScope scope) {
75 visitor.visit(this, scope);
76 visitor.endVisit(this, scope);