Unnecessary boxing issue
Consider the following case:
There's a method of MyClass called myMethod that accepts a long.
A call to that method looks like:
myClassInstance.myMethod(new Long(0));
Irida states that there is unnecessary boxing, which is true.
The problem is that when the intention removes the boxing what you get is:
myClassInstance.myMethod(0);
That is bad code as 0 is an int and not a long and IJ marks the modified
line as erroneous.
The correct line is:
myClassInstance.myMethod(0l);
I think that the intention should add the 'l' so that applying it won't
take good code and make it not compile.
Amnon
Please sign in to leave a comment.
A JIRA item for Dave please? :)
-
Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"
Easy enough. Submit a Jira item.
(And actually it will be 0L, rather than 0l, to avoid triggering a different inspection and generally looking confusing).
--Dave Griffith
Here it is:
http://www.jetbrains.net/jira/browse/IDEA-1624
Thanks,
Amnon
Maxim Shafirov (JetBrains) wrote: