Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316756

Summary: [nls tooling] Hover resolution of NLS references is thrown off by unused, incorrect 'BUNDLE_NAME'
Product: [Eclipse Project] JDT Reporter: John Cortell <john.cortell>
Component: TextAssignee: Dani Megert <daniel_megert>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: daniel_megert
Version: 3.6   
Target Milestone: 3.7 M1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Project referenced in reproducibility steps none

Description John Cortell CLA 2010-06-14 09:26:47 EDT
I sort of stumbled on this.

If a client has an NLS class where the 
(a) the .properties file is named after the NLS class
(b) the NLS class passes Messages.class.getName() to the NLS.initializeMessages() method, and
(c) the NLS has an unused BUNDLE_NAME definition that is incorrect

...the support to show the NLS string value by hovering over the reference is unnecessarily confused. The resolution logic appears to give precedence to using the BUNDLE_NAME over what is passed to the NLS.initializeMessages() method. Clearly, the latter is a more accurate source and should be given precedence.

To reproduce:
1. Import the attached project into a workspace
2. Open SampleAction.java and hover over "SampleAction_0". 
You will see the hover popup show "Hello World". This is expected, working behavior.
3. Open Messages.java. Uncomment the definition of BUNDLE_NAME. 
4. Repeat step 2.
You will see "The properties file could not be detected", even though BUNDLE_NAME is unused.
Comment 1 John Cortell CLA 2010-06-14 09:29:14 EDT
Created attachment 171825 [details]
Project referenced in reproducibility steps
Comment 2 Dani Megert CLA 2010-06-14 09:57:12 EDT
Fixed in NLSHintHelper rev. 1.41.
Comment 3 Dani Megert CLA 2010-06-14 09:57:26 EDT
.