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 Dev (Build 201312230002) Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08 Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18 System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb) User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev Throwable.initCause() returns "this" but Netbeans warns "throwable method result is ignored" if the code ignores this return value. It is perfectly reasonable to ignore the result of initCause() and use the original exception object as follows: catch (EntityNotFoundException e) { NoSuchFileException e2 = new NoSuchFileException(null); e2.initCause(e); throw e2; } Expected behavior: Suppress this warning for Throwable.initCause().
It looks like the hint is broken in a more general way. Given this code: ConstraintViolationException constraintViolation = SQLExceptions.getConstraintViolation(e); if (constraintViolation != null) throw new EntityExistsException(module.getName() + " " + version, e); throw e; Netbeans complaints that the result of "SQLExceptions.getConstraintViolation" is never used, but in fact it is used by the "if" statement.
just a note: 'throwable method ignored' is a completely different hint than 'unused value'.
Throwable.initCause is counted as 'valid' usage for the throwable as of jet-main#557e0d80c827 Please provide more complete code sample for issue #2 (unused assignment false warning). I've tried a more-or-less same code: public class Test { public void test(Throwable e) { ConstraintViolationException constraintViolation = null; // some usage to suppress hint on variable decl if (constraintViolation != null) {} constraintViolation = SQLExceptions.getConstraintViolation(e); if (constraintViolation != null) throw new IllegalArgumentException("", e); } } but no hint appeared on the constraintViolation assingment. File a new defect, please.
*** Bug 241125 has been marked as a duplicate of this bug. ***
Integrated into 'main-silver', will be available in build *201402040001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/557e0d80c827 User: Svata Dedic <sdedic@netbeans.org> Log: #239865: initCause counts as valid throwable usage