Idea for inspection/quickfix
I'm starting with this:
);
System.out.println("Color is " + color);]]>Inlining my makeColor method gave me this code:
) {
result = "Foo";
} else {
result = "Fie";
}
String color = result;
System.out.println("Color is " + color);]]>Clearly, the result variable could be eliminated and color used instead, like this:
) {
color = "Foo";
} else {
color = "Fie";
}
System.out.println("Color is " + color);]]>Surprisingly, IDEA didn't have an inspection for this. At least, I
didn't find one. Does it exist? Do we need a JIRA item?
/Mikael
Please sign in to leave a comment.
Hmmm. I would have thought "redundant local variable" would have caught
this, but apparently not.
Good suggestion. This could be part of the "Redundant Local Variable" inspection. A JIRA request, so this doesn't get lost, would be nice.
Added as http://www.jetbrains.net/jira/browse/IDEA-5408