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.
Summary: | "The if statement is redundant." seems to be backwards. | ||
---|---|---|---|
Product: | java | Reporter: | TradeIdeasPhilip |
Component: | Hints | Assignee: | Svata Dedic <sdedic> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 7.4 | ||
Hardware: | Macintosh | ||
OS: | Mac OS X | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
TradeIdeasPhilip
2013-11-13 02:09:16 UTC
The second if can be replaced by single return statement, as you can see when you apply the hint. That is why the hint is provided The first case is not detected to by the hints infrastructure to be redundant -> turning this to the enhancement Oh, I see. Thank you. No, I'm not asking for the first case to be a hint. I was just confused by the message. FYI, my original code looked a little more like this: boolean interesting(int a, int b) { if (a == b * 42) // The Douglas Adams. return true; if (b == a * 42) // The reverse Douglas Adams. return true; if (a == b * 420) // It's 4:20, dude! return true; return false; } Accepting the hint would make the code smaller, but less readable. I'll just disable that hint. Although this is older, it doesn't seem to properly understand, describe, or propose a resolution to the core problem. *** This bug has been marked as a duplicate of bug 254445 *** |