This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The redundant-if hint needs better explanation. Maybe change "The if statement is redundant" to "The if statement is redundant or mergeable - merging it with another branch with the same body could produce a simpler condition expression." Simply saying "The if statement is redundant" makes it sound like the if statement could be omitted because the cases it covers are also covered by other branches. However the below example shows that is not what it means. The hint appears to mean that the if-condition could be combined or merged with another branch with the same if-body to produce a simpler test. In the example below, the second 'if' gets the hint if its range meets or overlaps the first range, so the ranges could be combined into a single range. It does not get the hint if there is a gap between the ranges, so combining them might take an '||'. It does not get the hint if a statement is added to the if-body so the if-body is not the same as the earlier 'if'. public class RendundantIf { static boolean hasX(int c) { //... if (0xA <= c && c <= 0xC) { return true; } else if (0xD <= c && c <= 0xF) { //hint says "The if statement is redundant" return true; } else { return false; } } }
Agree that a better wording could be used, but the suggested message is too long to read / understand from the tooltip popup.