In the following class, "args != null" is always true:
{{code}package test;
// 7.0M2
public class TestIfElseFix
{
public static void main(String[] args) {
if (args.length == 0) {
System.out.println("No args");
} else if (args != null) {
System.out.println("Args");
System.out.println("Args again");
}
}
}{{code}
Accepting the quickfix at "args != null" leads to the following:
{{code}}package test;
// 7.0M2
public class TestIfElseFix
{
public static void main(String[] args) {
if (args.length == 0) {
System.out.println("No args");
} } else System.out.println("Args");
System.out.println("Args again");
}
}code
Notice that the braces are gone and "Args again" will always be printed. Depending on the original layout of the code it can be easy for this to slip by, introducing subtle bugs.