sneaky intentions bug...

Here's a fun one:

Integer.intValue() + "-" + 12

The single char string to char intention will helpfully suggest you replace the "-" with '-', which would, potentially, cause a showstopper bug, a highly agitated QA guy, an escalated issue, and about two hours of pouring through utterly unrelated code to find.

Intentions powers that be (that'd be Dave), please fix!

3 comments

Hello Hani,

Hani Suleiman wrote:

Here's a fun one:

Integer.intValue() + "-" + 12


Unfortunately that does not compile and I see no intention...

The single char string to char intention will helpfully suggest you
replace the "-" with '-', which would, potentially, cause a
showstopper bug, a highly agitated QA guy, an escalated issue, and
about two hours of pouring through utterly unrelated code to find.


I am currently unable to reproduce your problem. Which IDEA build are
you using? Perhaps a new example will help me, or even better a JIRA
request.

Intentions powers that be (that'd be Dave), please fix!


There are more powers these days;-)

Bas

0

Ok, my bad. (btw, I was using Integer.intValue() as an example, actual code is something like new Integer("20").intValue()

Anyway, I tried to create a testcase and the intention correctly doesn't suggest that a single char string concated to a bunch of primitives be converted to a char, and instead only suggests the second instance of the string is converted.

Time to hunt down the rogue developer who took matters in their own hands instead of trusting the intention and administering a beating.

0


Hani Suleiman wrote:

Ok, my bad. (btw, I was using Integer.intValue() as an example,
actual code is something like new Integer("20").intValue()

Anyway, I tried to create a testcase and the intention correctly
doesn't suggest that a single char string concated to a bunch of
primitives be converted to a char, and instead only suggests the
second instance of the string is converted.


Yep, it does. Of course I already knew this was working perfectly.

Time to hunt down the rogue developer who took matters in their own
hands instead of trusting the intention and administering a beating.


I hope they were sufficiently punished. Perhaps he or she used some
other static analysis tool?;-)

Bas

0

Please sign in to leave a comment.