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.
Product Version = NetBeans IDE 8.0.1 (Build 201408251540) Operating System = Linux version 3.13.0-36-generic running on amd64 Java; VM; Vendor = 1.7.0_67 Runtime = Java HotSpot(TM) 64-Bit Server VM 24.65-b04 Getting an invalid hint: "The if statement is redundant". public boolean applies(Date a_date) { if (a_date.before(getStartdate())) { return false; } if (a_date.after(getEnddate())) { // hint show on this if statement return false; } return true; }
What is wrong with the hint? The return statement and the last if can be combined into single return.
What you say is true. The hint "fixer" changes it to this: return !(a_range.getEnddate() != null && a_date.after(a_range.getEnddate())); which is accurate, but is in my opinion much harder to read. In the original the if statement is not redundant. It is coded that way as a personal coding style preference. It may be a matter of semantics with the word "redundant" or simply a coding style preference.
Sorry, I used the wrong method in my previous comment. The hint "fixer" changes it to: return !a_date.after(getEnddate());
In order to fix this, the IDE needs to know that after() returns always non-null