History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEABKL-3300
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Bas Leijdekkers
Reporter: Sergei Ivanov
Votes: 0
Watchers: 1
Available Workflow Actions

Mark as Stalled
Operations

If you were logged in you would be able to see more operations.
IDEA: Backlog

IPP: replace [new Integer(Integer.parseInt(s))] with [Integer.valueOf(s)]

Created: 11 Jul 05 19:31   Updated: 15 Jan 07 16:30
Component/s: Editor. Intention Actions
Affects Version/s: None
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 3,396
Severity: Low


 Description  « Hide
The idea is to replace all occurrences of this pattern:
new Integer(Integer.parseInt(s))
...with equivalent, but simpler code:
Integer.valueOf(s)

 All   Comments   Work Log   Change History      Sort Order:
Niels Ull Harremoës - 07 Oct 05 00:24
The intention (inspection?) could have a warning that this may change == semantics. This is unlikely to be a problem in 99.8% of the cases.

This should probably also find this for otter number classes, e.g. new Double(Double.parseDouble(s))

A somewhat simpler intention would be to replace
new Integer(s) with Integer.valueOf(s)
new Long(s) with Long.valueOf(s)
new Char(c) with Char.
et cetera for other simple type wrappers and BigDecimal/BigInteger.


Jonas Kvarnstrom - 15 Jan 07 16:30
And similarly, to replace "new Integer(s).intValue()" with "Integer.parseInt(s)".

This could potentially also be applied in contexts where auto-unboxing is used, so that an auto-unboxed "new Integer(s)" is replaced with "Integer.parseInt(s)" (an expression of this form just appeared in a student's exercise).