#1195 Additional rules for number types (avoid useless instantiation)

2.0.3
closed-fixed
rules (1)
5
2013-10-16
2013-07-04
No

I'd like to suggest addition of the following rules in FindBugs, regarding the number Types:

Mark the following constructs as bad (performance):
new Integer(myInt).toString() => to be replaced by Integer.toString(myInt)
new Integer(myString).intValue() => to be replaced by Integer.parseString(myString)

Discussion

  • William Pugh

    William Pugh - 2013-09-11

    Do you have any information about the frequency with which the bad idioms are used?

     
  • William Pugh

    William Pugh - 2013-09-11
    • assigned_to: William Pugh
     
  • William Pugh

    William Pugh - 2013-09-12
    • status: open --> open-accepted
     
  • William Pugh

    William Pugh - 2013-09-12

    OK, I've created a prototype detector that generates a TESTING bug instance. I need to evaluate it on a larger corpus, and won't be able to do that until next week.

     
  • William Pugh

    William Pugh - 2013-10-16
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.