missing intention ?

I placed the cursor everywhere, but couldn't trigger any intention to
convert

if(nofPlayers<2) __graphPlayer2.setVisible (false);
else __graphPlayer2.setVisible
(true);

into
__graphPlayer2.setVisible (2<=nofPlayers);

Is it missing, or am I missing something?

Alain

3 comments

No such intention exists. The current "simplify if-else" intentions only work if the branches are simple assignment statements or simple return statements. I'm currently in the process of cleaning up those intentions to look decent with the new Intention configuration panel, and will look into doing what you suggest. That said, I wouldn't expect much more than adding the special case (single method call with one argument changed) you describe. General "do these two code sections match except that one says true and the other says false" is likely way too hard to implement, and might result in semantic changes if the bodies have side effects that could change the condition.

--Dave Griffith

0

Oh, and if you could create a tracker item for this one, it'll make it less likely to slip off my plate.

--Dave Griffith

0

Dave

>Oh, and if you could create a tracker item for this one, it'll make it less likely to slip off my plate.

>

Done:
http://www.intellij.net/tracker/idea/viewSCR?publicId=38852
http://www.intellij.net/tracker/idea/viewSCR?publicId=38855

Alain

0

Please sign in to leave a comment.