Bug 157996 - [compiler] ProblemReferenceBinding missing a closestMatch
Summary: [compiler] ProblemReferenceBinding missing a closestMatch
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: 3.3 M3   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 156731
  Show dependency tree
 
Reported: 2006-09-20 10:24 EDT by Stephan Herrmann CLA
Modified: 2006-10-30 07:55 EST (History)
0 users

See Also:


Attachments
Proposed patch (23.68 KB, patch)
2006-10-20 06:08 EDT, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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