Bug 157996

Summary: [compiler] ProblemReferenceBinding missing a closestMatch
Product: [Eclipse Project] JDT Reporter: Stephan Herrmann <stephan.herrmann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.3 M3   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Bug Depends on:    
Bug Blocks: 156731    
Attachments:
Description Flags
Proposed patch none

Description Stephan Herrmann CLA 2006-09-20 10:24:31 EDT
In class BlockScope I found several occurrences of this snippet:
 if (!binding.isValidBinding())
    return new ProblemReferenceBinding(
          CharOperation.subarray(compoundName, 0, currentIndex),
          null, // TODO should improve
          binding.problemId());

See e.g. method getBinding(char[][],int,InvocationSite,boolean)

To me it looks like the "null" could simply be replaced by
          ((ProblemReferenceBinding)binding).closestMatch
The binding should be a ReferenceBinding in all these locations,
so the cast should be safe (?).

If, e.g., the problemId() is NotVisible, other parts of the system
should be allowed to assume that the problem binding has indeed a
closestMatch, shouldn't they?
Comment 1 Philipe Mulet CLA 2006-09-21 04:44:48 EDT
Definitily, visibility issues should still set the closest match to improve our resilience.
Comment 2 Philipe Mulet CLA 2006-10-20 06:08:08 EDT
Created attachment 52381 [details]
Proposed patch
Comment 3 Philipe Mulet CLA 2006-10-20 11:39:11 EDT
RELEASED FOR 3.3M3.
Fixed
Comment 4 David Audel CLA 2006-10-30 07:55:10 EST
Verified for 3.3 M3 using build I20061030-0010