1 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 17 ReferenceBinding resolvedType; 18 TypeBinding[] wrappers; 19 20 UnresolvedReferenceBinding(char[][] compoundName, PackageBinding packageBinding) { 21 this.compoundName = compoundName; 22 this.sourceName = compoundName[compoundName.length - 1]; this.fPackage = packageBinding; 24 this.wrappers = null; 25 } 26 void addWrapper(TypeBinding wrapper, LookupEnvironment environment) { 27 if (this.resolvedType != null) { 28 wrapper.swapUnresolved(this, this.resolvedType, environment); 31 return; 32 } 33 if (this.wrappers == null) { 34 this.wrappers = new TypeBinding[] {wrapper}; 35 } else { 36 int length = this.wrappers.length; 37 System.arraycopy(this.wrappers, 0, this.wrappers = new TypeBinding[length + 1], 0, length); 38 this.wrappers[length] = wrapper; 39 } 40 } 41 public String debugName() { 42 return toString(); 43 } 44 ReferenceBinding resolve(LookupEnvironment environment, boolean convertGenericToRawType) { 45 ReferenceBinding targetType = this.resolvedType; 46 if (targetType == null) { 47 targetType = this.fPackage.getType0(this.compoundName[this.compoundName.length - 1]); 48 if (targetType == this) 49 targetType = environment.askForType(this.compoundName); 50 if (targetType == null || targetType == this) { targetType = environment.cacheMissingBinaryType(this.compoundName, null); 53 } 54 setResolvedType(targetType, environment); 55 } 56 if (convertGenericToRawType) { 57 targetType = (ReferenceBinding) environment.convertUnresolvedBinaryToRawType(targetType); 58 } 59 return targetType; 60 } 61 void setResolvedType(ReferenceBinding targetType, LookupEnvironment environment) { 62 if (this.resolvedType == targetType) return; 64 this.resolvedType = targetType; 66 if (this.wrappers != null) 69 for (int i = 0, l = this.wrappers.length; i < l; i++) 70 this.wrappers[i].swapUnresolved(this, targetType, environment); 71 environment.updateCaches(this, targetType); 72 } 73 public String toString() { 74 return "Unresolved type " + ((compoundName != null) ? CharOperation.toString(compoundName) : "UNNAMED"); } 76 } 77 | Popular Tags |