Makefile fixup
[org.ibex.tool.git] / repo / org.ibex.tool / src / org / eclipse / jdt / internal / compiler / lookup / UnresolvedReferenceBinding.java
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.lookup;
12
13 import org.eclipse.jdt.core.compiler.CharOperation;
14
15 public class UnresolvedReferenceBinding extends ReferenceBinding {
16         ReferenceBinding resolvedType;
17 UnresolvedReferenceBinding(char[][] compoundName, PackageBinding packageBinding) {
18         this.compoundName = compoundName;
19         this.sourceName = compoundName[compoundName.length - 1]; // reasonable guess
20         this.fPackage = packageBinding;
21 }
22 String debugName() {
23         return toString();
24 }
25 ReferenceBinding resolve(LookupEnvironment environment) {
26         if (resolvedType != null) return resolvedType;
27
28         ReferenceBinding environmentType = fPackage.getType0(compoundName[compoundName.length - 1]);
29         if (environmentType == this)
30                 environmentType = environment.askForType(compoundName);
31         if (environmentType != null && environmentType != this) { // could not resolve any better, error was already reported against it
32                 resolvedType = environmentType;
33                 environment.updateArrayCache(this, environmentType);
34                 return environmentType; // when found, it replaces the unresolved type in the cache
35         }
36
37         environment.problemReporter.isClassPathCorrect(compoundName, null);
38         return null; // will not get here since the above error aborts the compilation
39 }
40 public String toString() {
41         return "Unresolved type " + ((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED"); //$NON-NLS-1$ //$NON-NLS-2$
42 }
43 }