View | Details | Raw Unified | Return to bug 157996
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java (-1 lines)
Lines 83-89 Link Here
83
	this.uniqueWildcardBindings = new SimpleLookupTable(3);
83
	this.uniqueWildcardBindings = new SimpleLookupTable(3);
84
	this.uniqueParameterizedGenericMethodBindings = new SimpleLookupTable(3);
84
	this.uniqueParameterizedGenericMethodBindings = new SimpleLookupTable(3);
85
	this.accessRestrictions = new HashMap(3);
85
	this.accessRestrictions = new HashMap(3);
86
	
87
	this.classFilePool = ClassFilePool.newInstance();
86
	this.classFilePool = ClassFilePool.newInstance();
88
}
87
}
89
88
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-10 / +10 lines)
Lines 992-998 Link Here
992
						if (visibleMemberType == null)
992
						if (visibleMemberType == null)
993
							visibleMemberType = memberType;
993
							visibleMemberType = memberType;
994
						else
994
						else
995
							return new ProblemReferenceBinding(typeName, null, ProblemReasons.Ambiguous);
995
							return new ProblemReferenceBinding(typeName, visibleMemberType, ProblemReasons.Ambiguous);
996
				} else {
996
				} else {
997
					notVisible = memberType;
997
					notVisible = memberType;
998
				}
998
				}
Lines 1009-1015 Link Here
1009
					if (visibleMemberType == null) {
1009
					if (visibleMemberType == null) {
1010
						visibleMemberType = memberType;
1010
						visibleMemberType = memberType;
1011
					} else {
1011
					} else {
1012
						ambiguous = new ProblemReferenceBinding(typeName, null, ProblemReasons.Ambiguous);
1012
						ambiguous = new ProblemReferenceBinding(typeName, visibleMemberType, ProblemReasons.Ambiguous);
1013
						break done;
1013
						break done;
1014
					}
1014
					}
1015
				} else {
1015
				} else {
Lines 2036-2042 Link Here
2036
			if (!binding.isValidBinding())
2036
			if (!binding.isValidBinding())
2037
				return new ProblemReferenceBinding(
2037
				return new ProblemReferenceBinding(
2038
					CharOperation.subarray(compoundName, 0, currentIndex),
2038
					CharOperation.subarray(compoundName, 0, currentIndex),
2039
					null, // TODO should improve
2039
					binding instanceof ReferenceBinding ? ((ReferenceBinding)binding).closestMatch() : null,
2040
					binding.problemId());
2040
					binding.problemId());
2041
			if (!(binding instanceof PackageBinding))
2041
			if (!(binding instanceof PackageBinding))
2042
				return packageBinding;
2042
				return packageBinding;
Lines 2075-2081 Link Here
2075
		if (!binding.isValidBinding())
2075
		if (!binding.isValidBinding())
2076
			return new ProblemReferenceBinding(
2076
			return new ProblemReferenceBinding(
2077
				CharOperation.arrayConcat(packageBinding.compoundName, name),
2077
				CharOperation.arrayConcat(packageBinding.compoundName, name),
2078
				null, // TODO should improve
2078
				binding instanceof ReferenceBinding ? ((ReferenceBinding)binding).closestMatch() : null,
2079
				binding.problemId());
2079
				binding.problemId());
2080
2080
2081
		ReferenceBinding typeBinding = (ReferenceBinding) binding;
2081
		ReferenceBinding typeBinding = (ReferenceBinding) binding;
Lines 2122-2128 Link Here
2122
				if (!binding.isValidBinding())
2122
				if (!binding.isValidBinding())
2123
					return new ProblemReferenceBinding(
2123
					return new ProblemReferenceBinding(
2124
						CharOperation.subarray(compoundName, 0, currentIndex),
2124
						CharOperation.subarray(compoundName, 0, currentIndex),
2125
						null, // TODO should improve
2125
						binding instanceof ReferenceBinding ? ((ReferenceBinding)binding).closestMatch() : null,
2126
						binding.problemId());
2126
						binding.problemId());
2127
				if (!(binding instanceof PackageBinding))
2127
				if (!(binding instanceof PackageBinding))
2128
					break;
2128
					break;
Lines 2153-2164 Link Here
2153
					ProblemReferenceBinding problemBinding = (ProblemReferenceBinding) typeBinding;
2153
					ProblemReferenceBinding problemBinding = (ProblemReferenceBinding) typeBinding;
2154
					return new ProblemReferenceBinding(
2154
					return new ProblemReferenceBinding(
2155
						CharOperation.subarray(compoundName, 0, currentIndex),
2155
						CharOperation.subarray(compoundName, 0, currentIndex),
2156
						problemBinding.closestMatch,
2156
						problemBinding.closestMatch(),
2157
						typeBinding.problemId());
2157
						typeBinding.problemId());
2158
				}
2158
				}
2159
				return new ProblemReferenceBinding(
2159
				return new ProblemReferenceBinding(
2160
					CharOperation.subarray(compoundName, 0, currentIndex),
2160
					CharOperation.subarray(compoundName, 0, currentIndex),
2161
					null, // TODO should improve
2161
					((ReferenceBinding)binding).closestMatch(),
2162
					typeBinding.problemId());
2162
					typeBinding.problemId());
2163
			}
2163
			}
2164
		}
2164
		}
Lines 2346-2352 Link Here
2346
								if (importReference != null) importReference.used = true;
2346
								if (importReference != null) importReference.used = true;
2347
								if (foundInImport) {
2347
								if (foundInImport) {
2348
									// Answer error binding -- import on demand conflict; name found in two import on demand packages.
2348
									// Answer error binding -- import on demand conflict; name found in two import on demand packages.
2349
									temp = new ProblemReferenceBinding(name, null, ProblemReasons.Ambiguous);
2349
									temp = new ProblemReferenceBinding(name, type, ProblemReasons.Ambiguous);
2350
									if (typeOrPackageCache != null)
2350
									if (typeOrPackageCache != null)
2351
										typeOrPackageCache.put(name, temp);
2351
										typeOrPackageCache.put(name, temp);
2352
									return temp;
2352
									return temp;
Lines 2414-2420 Link Here
2414
				if (!binding.isValidBinding())
2414
				if (!binding.isValidBinding())
2415
					return new ProblemReferenceBinding(
2415
					return new ProblemReferenceBinding(
2416
						CharOperation.subarray(compoundName, 0, currentIndex),
2416
						CharOperation.subarray(compoundName, 0, currentIndex),
2417
						null, // TODO should improve
2417
						binding instanceof ReferenceBinding ? ((ReferenceBinding)binding).closestMatch() : null,
2418
						binding.problemId());
2418
						binding.problemId());
2419
				if (!(binding instanceof PackageBinding))
2419
				if (!(binding instanceof PackageBinding))
2420
					break;
2420
					break;
Lines 2440-2446 Link Here
2440
			if (!typeBinding.isValidBinding())
2440
			if (!typeBinding.isValidBinding())
2441
				return new ProblemReferenceBinding(
2441
				return new ProblemReferenceBinding(
2442
					CharOperation.subarray(compoundName, 0, currentIndex),
2442
					CharOperation.subarray(compoundName, 0, currentIndex),
2443
					null, // TODO should improve
2443
					((ReferenceBinding)binding).closestMatch(),
2444
					typeBinding.problemId());
2444
					typeBinding.problemId());
2445
			
2445
			
2446
			if (typeBinding.isGenericType()) {
2446
			if (typeBinding.isGenericType()) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java (-12 / +15 lines)
Lines 454-460 Link Here
454
				if (!binding.isValidBinding())
454
				if (!binding.isValidBinding())
455
					return new ProblemReferenceBinding(
455
					return new ProblemReferenceBinding(
456
						CharOperation.subarray(compoundName, 0, currentIndex),
456
						CharOperation.subarray(compoundName, 0, currentIndex),
457
						null, // TODO should improve
457
						((ReferenceBinding)binding).closestMatch(),
458
						binding.problemId());
458
						binding.problemId());
459
				if (!((ReferenceBinding) binding).canBeSeenBy(this))
459
				if (!((ReferenceBinding) binding).canBeSeenBy(this))
460
					return new ProblemReferenceBinding(
460
					return new ProblemReferenceBinding(
Lines 476-486 Link Here
476
	// know binding is now a ReferenceBinding
476
	// know binding is now a ReferenceBinding
477
	binding = environment().convertToRawType((ReferenceBinding) binding);
477
	binding = environment().convertToRawType((ReferenceBinding) binding);
478
	while (currentIndex < length) {
478
	while (currentIndex < length) {
479
		ReferenceBinding typeBinding = (ReferenceBinding) binding;
479
		ReferenceBinding referenceBinding = (ReferenceBinding) binding;
480
		char[] nextName = compoundName[currentIndex++];
480
		char[] nextName = compoundName[currentIndex++];
481
		invocationSite.setFieldIndex(currentIndex);
481
		invocationSite.setFieldIndex(currentIndex);
482
		invocationSite.setActualReceiverType(typeBinding);
482
		invocationSite.setActualReceiverType(referenceBinding);
483
		if ((mask & Binding.FIELD) != 0 && (binding = findField(typeBinding, nextName, invocationSite, true /*resolve*/)) != null) {
483
		if ((mask & Binding.FIELD) != 0 && (binding = findField(referenceBinding, nextName, invocationSite, true /*resolve*/)) != null) {
484
			if (!binding.isValidBinding()) {
484
			if (!binding.isValidBinding()) {
485
				return new ProblemFieldBinding(
485
				return new ProblemFieldBinding(
486
					((ProblemFieldBinding)binding).closestMatch,
486
					((ProblemFieldBinding)binding).closestMatch,
Lines 490-511 Link Here
490
			}
490
			}
491
			break; // binding is now a field
491
			break; // binding is now a field
492
		}
492
		}
493
		if ((binding = findMemberType(nextName, typeBinding)) == null) {
493
		if ((binding = findMemberType(nextName, referenceBinding)) == null) {
494
			if ((mask & Binding.FIELD) != 0) {
494
			if ((mask & Binding.FIELD) != 0) {
495
				return new ProblemBinding(
495
				return new ProblemBinding(
496
					CharOperation.subarray(compoundName, 0, currentIndex),
496
					CharOperation.subarray(compoundName, 0, currentIndex),
497
					typeBinding,
497
					referenceBinding,
498
					ProblemReasons.NotFound);
498
					ProblemReasons.NotFound);
499
			} 
499
			} 
500
			return new ProblemReferenceBinding(
500
			return new ProblemReferenceBinding(
501
				CharOperation.subarray(compoundName, 0, currentIndex),
501
				CharOperation.subarray(compoundName, 0, currentIndex),
502
				typeBinding,
502
				referenceBinding,
503
				ProblemReasons.NotFound);
503
				ProblemReasons.NotFound);
504
		}
504
		}
505
		// binding is a ReferenceBinding
505
		if (!binding.isValidBinding())
506
		if (!binding.isValidBinding())
506
			return new ProblemReferenceBinding(
507
			return new ProblemReferenceBinding(
507
				CharOperation.subarray(compoundName, 0, currentIndex),
508
				CharOperation.subarray(compoundName, 0, currentIndex),
508
				null, // TODO should improve
509
				((ReferenceBinding)binding).closestMatch(),
509
				binding.problemId());
510
				binding.problemId());
510
	}
511
	}
511
	if ((mask & Binding.FIELD) != 0 && (binding instanceof FieldBinding)) {
512
	if ((mask & Binding.FIELD) != 0 && (binding instanceof FieldBinding)) {
Lines 563-569 Link Here
563
				if (!binding.isValidBinding())
564
				if (!binding.isValidBinding())
564
					return new ProblemReferenceBinding(
565
					return new ProblemReferenceBinding(
565
						CharOperation.subarray(compoundName, 0, currentIndex),
566
						CharOperation.subarray(compoundName, 0, currentIndex),
566
						null, // TODO should improve
567
						((ReferenceBinding)binding).closestMatch(),
567
						binding.problemId());
568
						binding.problemId());
568
				if (!((ReferenceBinding) binding).canBeSeenBy(this))
569
				if (!((ReferenceBinding) binding).canBeSeenBy(this))
569
					return new ProblemReferenceBinding(
570
					return new ProblemReferenceBinding(
Lines 596-611 Link Here
596
						ProblemReasons.NonStaticReferenceInStaticContext);
597
						ProblemReasons.NonStaticReferenceInStaticContext);
597
				break foundField; // binding is now a field
598
				break foundField; // binding is now a field
598
			}
599
			}
599
			if ((binding = findMemberType(nextName, typeBinding)) == null)
600
			if ((binding = findMemberType(nextName, typeBinding)) == null) {
600
				return new ProblemBinding(
601
				return new ProblemBinding(
601
					CharOperation.subarray(compoundName, 0, currentIndex),
602
					CharOperation.subarray(compoundName, 0, currentIndex),
602
					typeBinding,
603
					typeBinding,
603
					ProblemReasons.NotFound);
604
					ProblemReasons.NotFound);
604
			if (!binding.isValidBinding())
605
			}
606
			if (!binding.isValidBinding()) {
605
				return new ProblemReferenceBinding(
607
				return new ProblemReferenceBinding(
606
					CharOperation.subarray(compoundName, 0, currentIndex),
608
					CharOperation.subarray(compoundName, 0, currentIndex),
607
					null, // TODO should improve
609
					((ReferenceBinding)binding).closestMatch(),
608
					binding.problemId());
610
					binding.problemId());
611
			}
609
		}
612
		}
610
		return binding;
613
		return binding;
611
	}
614
	}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java (+9 lines)
Lines 311-316 Link Here
311
	// isDefault()
311
	// isDefault()
312
	return invocationType.fPackage == this.fPackage;
312
	return invocationType.fPackage == this.fPackage;
313
}
313
}
314
315
/**
316
 * In case of problems, returns the closest match found. It may not be perfect match, but the
317
 * result of a best effort to improve fault-tolerance.
318
*/
319
public ReferenceBinding closestMatch() {
320
	return this; // by default, the closest match is the binding itself
321
}
322
314
public char[] computeGenericTypeSignature(TypeVariableBinding[] typeVariables) {
323
public char[] computeGenericTypeSignature(TypeVariableBinding[] typeVariables) {
315
324
316
	boolean isMemberOfGeneric = isMemberType() && (enclosingType().modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0;
325
	boolean isMemberOfGeneric = isMemberType() && (enclosingType().modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java (-1 / +9 lines)
Lines 11-17 Link Here
11
package org.eclipse.jdt.internal.compiler.lookup;
11
package org.eclipse.jdt.internal.compiler.lookup;
12
12
13
public class ProblemReferenceBinding extends ReferenceBinding {
13
public class ProblemReferenceBinding extends ReferenceBinding {
14
	public ReferenceBinding closestMatch;
14
	private ReferenceBinding closestMatch;
15
	private int problemReason;
15
	private int problemReason;
16
	
16
	
17
// NOTE: must only answer the subset of the name related to the problem
17
// NOTE: must only answer the subset of the name related to the problem
Lines 24-29 Link Here
24
public ProblemReferenceBinding(char[] name, ReferenceBinding closestMatch, int problemReason) {
24
public ProblemReferenceBinding(char[] name, ReferenceBinding closestMatch, int problemReason) {
25
	this(new char[][] {name}, closestMatch, problemReason);
25
	this(new char[][] {name}, closestMatch, problemReason);
26
}
26
}
27
28
/**
29
 * @see org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#closestMatch()
30
 */
31
public ReferenceBinding closestMatch() {
32
	return this.closestMatch;
33
}
34
27
/* API
35
/* API
28
* Answer the problem id associated with the receiver.
36
* Answer the problem id associated with the receiver.
29
* NoError if the receiver is a valid binding.
37
* NoError if the receiver is a valid binding.
(-)search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java (-3 / +3 lines)
Lines 156-162 Link Here
156
			long[] positions = importRef.sourcePositions;
156
			long[] positions = importRef.sourcePositions;
157
			int last = positions.length - 1;
157
			int last = positions.length - 1;
158
			if (binding instanceof ProblemReferenceBinding)
158
			if (binding instanceof ProblemReferenceBinding)
159
				binding = ((ProblemReferenceBinding) binding).closestMatch;
159
				binding = ((ProblemReferenceBinding) binding).closestMatch();
160
			if (binding instanceof ReferenceBinding) {
160
			if (binding instanceof ReferenceBinding) {
161
				PackageBinding pkgBinding = ((ReferenceBinding) binding).fPackage;
161
				PackageBinding pkgBinding = ((ReferenceBinding) binding).fPackage;
162
				if (pkgBinding != null)
162
				if (pkgBinding != null)
Lines 220-226 Link Here
220
		if (typeBinding instanceof ArrayBinding)
220
		if (typeBinding instanceof ArrayBinding)
221
			typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
221
			typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
222
		if (typeBinding instanceof ProblemReferenceBinding)
222
		if (typeBinding instanceof ProblemReferenceBinding)
223
			typeBinding = ((ProblemReferenceBinding) typeBinding).closestMatch;
223
			typeBinding = ((ProblemReferenceBinding) typeBinding).closestMatch();
224
		if (typeBinding instanceof ReferenceBinding) {
224
		if (typeBinding instanceof ReferenceBinding) {
225
			PackageBinding pkgBinding = ((ReferenceBinding) typeBinding).fPackage;
225
			PackageBinding pkgBinding = ((ReferenceBinding) typeBinding).fPackage;
226
			if (pkgBinding != null)
226
			if (pkgBinding != null)
Lines 283-289 Link Here
283
		if (binding instanceof ArrayBinding)
283
		if (binding instanceof ArrayBinding)
284
			binding = ((ArrayBinding) binding).leafComponentType;
284
			binding = ((ArrayBinding) binding).leafComponentType;
285
		if (binding instanceof ProblemReferenceBinding)
285
		if (binding instanceof ProblemReferenceBinding)
286
			binding = ((ProblemReferenceBinding) binding).closestMatch;
286
			binding = ((ProblemReferenceBinding) binding).closestMatch();
287
		if (binding == null) return INACCURATE_MATCH;
287
		if (binding == null) return INACCURATE_MATCH;
288
288
289
		if (binding instanceof ReferenceBinding) {
289
		if (binding instanceof ReferenceBinding) {
(-)search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java (-7 / +7 lines)
Lines 220-226 Link Here
220
		}
220
		}
221
		if (typeBinding instanceof ProblemReferenceBinding) {
221
		if (typeBinding instanceof ProblemReferenceBinding) {
222
			ProblemReferenceBinding pbBinding = (ProblemReferenceBinding) typeBinding;
222
			ProblemReferenceBinding pbBinding = (ProblemReferenceBinding) typeBinding;
223
			typeBinding = pbBinding.closestMatch;
223
			typeBinding = pbBinding.closestMatch();
224
			lastIndex = pbBinding.compoundName.length - 1;
224
			lastIndex = pbBinding.compoundName.length - 1;
225
		}
225
		}
226
		// try to match all enclosing types for which the token matches as well.
226
		// try to match all enclosing types for which the token matches as well.
Lines 394-400 Link Here
394
	}
394
	}
395
	if (typeBinding instanceof ProblemReferenceBinding) {
395
	if (typeBinding instanceof ProblemReferenceBinding) {
396
		ProblemReferenceBinding pbBinding = (ProblemReferenceBinding) typeBinding;
396
		ProblemReferenceBinding pbBinding = (ProblemReferenceBinding) typeBinding;
397
		typeBinding = pbBinding.closestMatch;
397
		typeBinding = pbBinding.closestMatch();
398
		lastIndex = pbBinding.compoundName.length - 1;
398
		lastIndex = pbBinding.compoundName.length - 1;
399
	}
399
	}
400
400
Lines 439-445 Link Here
439
		typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
439
		typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
440
	if (typeBinding instanceof ProblemReferenceBinding) {
440
	if (typeBinding instanceof ProblemReferenceBinding) {
441
		ProblemReferenceBinding pbBinding = (ProblemReferenceBinding) typeBinding;
441
		ProblemReferenceBinding pbBinding = (ProblemReferenceBinding) typeBinding;
442
		typeBinding = pbBinding.closestMatch;
442
		typeBinding = pbBinding.closestMatch();
443
		lastIndex = pbBinding.compoundName.length - 1;
443
		lastIndex = pbBinding.compoundName.length - 1;
444
	}
444
	}
445
445
Lines 575-581 Link Here
575
		typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
575
		typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
576
	if (typeBinding == null || typeBinding instanceof BaseTypeBinding) return;
576
	if (typeBinding == null || typeBinding instanceof BaseTypeBinding) return;
577
	if (typeBinding instanceof ProblemReferenceBinding) {
577
	if (typeBinding instanceof ProblemReferenceBinding) {
578
		ReferenceBinding original = ((ProblemReferenceBinding) typeBinding).closestMatch;
578
		ReferenceBinding original = ((ProblemReferenceBinding) typeBinding).closestMatch();
579
		if (original == null) return; // original may not be set (bug 71279)
579
		if (original == null) return; // original may not be set (bug 71279)
580
		typeBinding = original;
580
		typeBinding = original;
581
	}
581
	}
Lines 637-643 Link Here
637
	if (typeBinding instanceof ArrayBinding)
637
	if (typeBinding instanceof ArrayBinding)
638
		typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
638
		typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
639
	if (typeBinding instanceof ProblemReferenceBinding)
639
	if (typeBinding instanceof ProblemReferenceBinding)
640
		typeBinding = ((ProblemReferenceBinding) typeBinding).closestMatch;
640
		typeBinding = ((ProblemReferenceBinding) typeBinding).closestMatch();
641
641
642
	if (((InternalSearchPattern) this.pattern).focus instanceof IType && typeBinding instanceof ReferenceBinding) {
642
	if (((InternalSearchPattern) this.pattern).focus instanceof IType && typeBinding instanceof ReferenceBinding) {
643
		IPackageFragment pkg = ((IType) ((InternalSearchPattern) this.pattern).focus).getPackageFragment();
643
		IPackageFragment pkg = ((IType) ((InternalSearchPattern) this.pattern).focus).getPackageFragment();
Lines 653-659 Link Here
653
653
654
	if (nameRef instanceof SingleNameReference) {
654
	if (nameRef instanceof SingleNameReference) {
655
		if (binding instanceof ProblemReferenceBinding)
655
		if (binding instanceof ProblemReferenceBinding)
656
			binding = ((ProblemReferenceBinding) binding).closestMatch;
656
			binding = ((ProblemReferenceBinding) binding).closestMatch();
657
		if (binding instanceof ReferenceBinding)
657
		if (binding instanceof ReferenceBinding)
658
			return resolveLevelForType((ReferenceBinding) binding);
658
			return resolveLevelForType((ReferenceBinding) binding);
659
		return binding == null || binding instanceof ProblemBinding ? INACCURATE_MATCH : IMPOSSIBLE_MATCH;
659
		return binding == null || binding instanceof ProblemBinding ? INACCURATE_MATCH : IMPOSSIBLE_MATCH;
Lines 700-706 Link Here
700
	if (typeBinding instanceof ArrayBinding)
700
	if (typeBinding instanceof ArrayBinding)
701
		typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
701
		typeBinding = ((ArrayBinding) typeBinding).leafComponentType;
702
	if (typeBinding instanceof ProblemReferenceBinding)
702
	if (typeBinding instanceof ProblemReferenceBinding)
703
		typeBinding = ((ProblemReferenceBinding) typeBinding).closestMatch;
703
		typeBinding = ((ProblemReferenceBinding) typeBinding).closestMatch();
704
704
705
	if (typeRef instanceof SingleTypeReference) {
705
	if (typeRef instanceof SingleTypeReference) {
706
		return resolveLevelForType(typeBinding);
706
		return resolveLevelForType(typeBinding);
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java (-2 / +2 lines)
Lines 448-454 Link Here
448
	 			if (!binding.isValidBinding())
448
	 			if (!binding.isValidBinding())
449
					return new ProblemReferenceBinding(
449
					return new ProblemReferenceBinding(
450
									CharOperation.subarray(compoundName, 0, currentIndex), 
450
									CharOperation.subarray(compoundName, 0, currentIndex), 
451
									null, // TODO should improve
451
									((ReferenceBinding)binding).closestMatch(),
452
									binding.problemId());
452
									binding.problemId());
453
	 			if (!this.canBeSeenByForCodeSnippet((ReferenceBinding) binding, receiverType))
453
	 			if (!this.canBeSeenByForCodeSnippet((ReferenceBinding) binding, receiverType))
454
					return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), (ReferenceBinding) binding, ProblemReasons.NotVisible);
454
					return new ProblemReferenceBinding(CharOperation.subarray(compoundName, 0, currentIndex), (ReferenceBinding) binding, ProblemReasons.NotVisible);
Lines 481-487 Link Here
481
		 if (!binding.isValidBinding())
481
		 if (!binding.isValidBinding())
482
			return new ProblemReferenceBinding(
482
			return new ProblemReferenceBinding(
483
								CharOperation.subarray(compoundName, 0, currentIndex), 
483
								CharOperation.subarray(compoundName, 0, currentIndex), 
484
								null, // TODO should improve
484
								((ReferenceBinding)binding).closestMatch(),
485
								binding.problemId());
485
								binding.problemId());
486
	}
486
	}
487
487
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java (-1 / +1 lines)
Lines 43-49 Link Here
43
					ProblemReferenceBinding problemBinding = (ProblemReferenceBinding) this.resolvedType;
43
					ProblemReferenceBinding problemBinding = (ProblemReferenceBinding) this.resolvedType;
44
					this.resolvedType = new ProblemReferenceBinding(
44
					this.resolvedType = new ProblemReferenceBinding(
45
						org.eclipse.jdt.core.compiler.CharOperation.subarray(this.tokens, 0, tokenIndex + 1),
45
						org.eclipse.jdt.core.compiler.CharOperation.subarray(this.tokens, 0, tokenIndex + 1),
46
						problemBinding.closestMatch,
46
						problemBinding.closestMatch(),
47
						this.resolvedType.problemId());
47
						this.resolvedType.problemId());
48
				}
48
				}
49
			}
49
			}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java (-1 / +1 lines)
Lines 65-71 Link Here
65
				this.packageBinding = (PackageBinding) binding;
65
				this.packageBinding = (PackageBinding) binding;
66
			} else {
66
			} else {
67
				if (this.resolvedType.problemId() == ProblemReasons.NonStaticReferenceInStaticContext) {
67
				if (this.resolvedType.problemId() == ProblemReasons.NonStaticReferenceInStaticContext) {
68
					ReferenceBinding closestMatch = ((ProblemReferenceBinding)this.resolvedType).closestMatch;
68
					ReferenceBinding closestMatch = ((ProblemReferenceBinding)this.resolvedType).closestMatch();
69
					if (closestMatch != null && closestMatch.isTypeVariable()) {
69
					if (closestMatch != null && closestMatch.isTypeVariable()) {
70
						this.resolvedType = closestMatch; // ignore problem as we want report specific javadoc one instead
70
						this.resolvedType = closestMatch; // ignore problem as we want report specific javadoc one instead
71
						return resolvedType;
71
						return resolvedType;
(-)dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java (-1 / +1 lines)
Lines 275-281 Link Here
275
				case ProblemReasons.NonStaticReferenceInStaticContext :
275
				case ProblemReasons.NonStaticReferenceInStaticContext :
276
					if (referenceBinding instanceof ProblemReferenceBinding) {
276
					if (referenceBinding instanceof ProblemReferenceBinding) {
277
						ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) referenceBinding;
277
						ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) referenceBinding;
278
						Binding binding2 = problemReferenceBinding.closestMatch;
278
						Binding binding2 = problemReferenceBinding.closestMatch();
279
						if (binding2 != null && binding2 instanceof org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
279
						if (binding2 != null && binding2 instanceof org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
280
							TypeBinding binding = (TypeBinding) this.bindingTables.compilerBindingsToASTBindings.get(binding2);
280
							TypeBinding binding = (TypeBinding) this.bindingTables.compilerBindingsToASTBindings.get(binding2);
281
							if (binding != null) {
281
							if (binding != null) {
(-)model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java (-2 / +2 lines)
Lines 295-301 Link Here
295
				TypeReference superclassRef = typeDeclaration == null ? null : typeDeclaration.superclass;
295
				TypeReference superclassRef = typeDeclaration == null ? null : typeDeclaration.superclass;
296
				TypeBinding superclass = superclassRef == null ? null : superclassRef.resolvedType;
296
				TypeBinding superclass = superclassRef == null ? null : superclassRef.resolvedType;
297
				if (superclass instanceof ProblemReferenceBinding) {
297
				if (superclass instanceof ProblemReferenceBinding) {
298
					superclass = ((ProblemReferenceBinding) superclass).closestMatch;
298
					superclass = ((ProblemReferenceBinding) superclass).closestMatch();
299
				}
299
				}
300
				if (superclass != null) 
300
				if (superclass != null) 
301
					((SourceTypeBinding) typeBinding).superclass = (ReferenceBinding) superclass;
301
					((SourceTypeBinding) typeBinding).superclass = (ReferenceBinding) superclass;
Lines 309-315 Link Here
309
					for (int i = 0; i < length; i++) {
309
					for (int i = 0; i < length; i++) {
310
						ReferenceBinding superInterface = (ReferenceBinding) superInterfaces[i].resolvedType;
310
						ReferenceBinding superInterface = (ReferenceBinding) superInterfaces[i].resolvedType;
311
						if (superInterface instanceof ProblemReferenceBinding)
311
						if (superInterface instanceof ProblemReferenceBinding)
312
							superInterface = ((ProblemReferenceBinding) superInterface).closestMatch;
312
							superInterface = superInterface.closestMatch();
313
						if (superInterface != null)
313
						if (superInterface != null)
314
							interfaceBindings[index++] = superInterface;
314
							interfaceBindings[index++] = superInterface;
315
					}
315
					}
(-)codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java (-2 / +1 lines)
Lines 821-829 Link Here
821
			this.acceptedAnswer = true;
821
			this.acceptedAnswer = true;
822
		} else if (binding instanceof ReferenceBinding) {
822
		} else if (binding instanceof ReferenceBinding) {
823
			ReferenceBinding typeBinding = (ReferenceBinding) binding;
823
			ReferenceBinding typeBinding = (ReferenceBinding) binding;
824
			
825
			if(typeBinding instanceof ProblemReferenceBinding) {
824
			if(typeBinding instanceof ProblemReferenceBinding) {
826
				typeBinding = ((ProblemReferenceBinding) typeBinding).closestMatch;
825
				typeBinding = typeBinding.closestMatch();
827
			}
826
			}
828
			if (typeBinding == null) return;
827
			if (typeBinding == null) return;
829
			if (isLocal(typeBinding) && this.requestor instanceof SelectionRequestor) {
828
			if (isLocal(typeBinding) && this.requestor instanceof SelectionRequestor) {

Return to bug 157996