Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 559058 - [save actions] use autoboxing removes needed valueOf() call
Summary: [save actions] use autoboxing removes needed valueOf() call
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.14   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 4.15 M3   Edit
Assignee: Fabrice Tiercelin CLA
QA Contact: Jeff Johnston CLA
URL:
Whiteboard:
Keywords:
Depends on: 549899 551614
Blocks:
  Show dependency tree
 
Reported: 2020-01-11 05:02 EST by Frank Benoit CLA
Modified: 2020-11-21 06:40 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Benoit CLA 2020-01-11 05:02:17 EST
Given this code:

String macroLine = "0"; // string from somewhere
Long offset = Long.valueOf(macroLine.substring(7));

After save, is changed to:
String macroLine = "0";
Long offset = macroLine.substring(7);

And this is no more compiling, as String cannot be automatically converted to Long.

When the setting, save actions, additional actions, unneccessary code, "use autoboxing" is unchecked, this behavior goes away.

See example here:
https://github.com/eclipse-cdt/cdt/blob/master/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java#L796
Comment 1 Fabrice Tiercelin CLA 2020-01-16 06:28:24 EST
Bug 551614 will fix it when it will be merged.
Comment 2 Jeff Johnston CLA 2020-01-20 17:55:00 EST
Released for 4.15M3
Comment 3 Fabrice Tiercelin CLA 2020-11-21 06:40:51 EST
Verified for 4.18M3 using I20201116-1800 build