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

Bug 341494

Summary: Elements.getConstantExpression(Object) doesn't return the right value for String constant
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: APTAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse
Version: 3.7   
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed fix + regression tests none

Description Olivier Thomann CLA 2011-03-31 10:40:29 EDT
Using latest, this doesn't return a string representation for string constants. There is no double quotes at the beginning and the end of the return value which doesn't make it a string representation of the string constant.
Comment 1 Olivier Thomann CLA 2011-03-31 10:52:12 EDT
Created attachment 192284 [details]
Proposed fix + regression tests
Comment 2 Walter Harley CLA 2011-03-31 13:26:17 EDT
+1; this looks like a correct patch for 3.7.

It is surprising that no one has run into this yet.  Hopefully fixing this bug will not break existing processors written to the incorrect behavior!  I think fixing it is the right thing to do, though.
Comment 3 Olivier Thomann CLA 2011-03-31 13:50:32 EDT
(In reply to comment #2)
> It is surprising that no one has run into this yet.  Hopefully fixing this bug
> will not break existing processors written to the incorrect behavior!  I think
> fixing it is the right thing to do, though.
Too bad if existing processors rely on a bug. javac doesn't have the bug so users that would try their processors on javac as well should see the problem.
I released the change and I tagged the map file.
Comment 4 Olivier Thomann CLA 2011-03-31 13:50:58 EDT
Thanks for validating the patch, Walter.