| Summary: | [move member type] Convert to top level looses literal initializers when changing visibility | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Luke Hutchison <luke.hutch> | ||||||||
| Component: | UI | Assignee: | Markus Keller <markus.kell.r> | ||||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||||
| Severity: | major | ||||||||||
| Priority: | P3 | CC: | daniel_megert, deepakazad, markus.kell.r | ||||||||
| Version: | 3.7 | ||||||||||
| Target Milestone: | 3.7 M3 | ||||||||||
| Hardware: | All | ||||||||||
| OS: | All | ||||||||||
| Whiteboard: | |||||||||||
| Bug Depends on: | 325131 | ||||||||||
| Bug Blocks: | |||||||||||
| Attachments: |
|
||||||||||
Created attachment 178759 [details] First stab Unfortunately, the patch is too ugly for M2. I tried to use a WeakHashMap, but I had to discover that WHM leaks values, unless the map is used again after a key has been garbage collected... . Waiting for bug 325131 which will make a good fix possible. Created attachment 180499 [details]
Fix
Fixed in HEAD. Created attachment 180878 [details]
Fix 2
The original fix didn't work in cases where a multi-field declaration had to be split and the new fragment got touched twice. Fixed in HEAD.
Verified in I20101025-1800. |
Build Identifier: 20100218-1602 Given the following code: class A { class B { private static final String TAG1 = "tag1", TAG2 = "tag2"; } String X = B.TAG1, Y = B.TAG2; } If you convert class B to toplevel, then you are warned about needing to change the visibility of TAG1 and TAG2 to default. After refactoring you get: class B { static final String TAG1; static final String TAG2; } which loses the String literal initializer values. Reproducible: Always Steps to Reproduce: (as above)