Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341494 - Elements.getConstantExpression(Object) doesn't return the right value for String constant
Summary: Elements.getConstantExpression(Object) doesn't return the right value for Str...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: APT (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-31 10:40 EDT by Olivier Thomann CLA
Modified: 2011-03-31 13:50 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix + regression tests (6.84 KB, patch)
2011-03-31 10:52 EDT, Olivier Thomann CLA
no flags Details | Diff

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