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.

Bug 247933 - "Throwable method result is ignored" is of dubious value
Summary: "Throwable method result is ignored" is of dubious value
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-14 18:36 UTC by _ gtzabari
Modified: 2015-08-11 01:15 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2014-10-14 18:36:29 UTC
The description for the "Throwable method result is ignored" hint indicates we should be storing the returned Throwable in order to "save time for Throwable's stacktrace creation." It seems you want to reduce the number of times Throwable.fillInStackTrace() gets invoked, but I think the condition you are checking for (methods returning Throwable) is way too broad to be useful. This results in many false positives. For example:

SQLException current = result;
while (current.getNextException() != null)
{
	chainedExceptions.add(current);
	current = current.getNextException();
}

In the above case, current.getNextException() triggers the warning but it is not actually invoking fillInStackTrace() per call. The stacktrace has already been generated a long time ago.

Consider changing the condition that triggers this hint, or removing the hint altogether.
Comment 1 Svata Dedic 2015-07-27 13:37:11 UTC
The main value of the hint is to point out to possible unhandled exception conditions, the performance is just a side effect. The hint should not trigger in the presented case, as the Throwable from current.getNextException() is used in null comparison.
Comment 2 Svata Dedic 2015-08-07 12:23:15 UTC
Uh-oh ... usage in loop control condition was not detected as valid usage.

Fixed as jet-main#8fe23bcf31e3
Comment 3 Quality Engineering 2015-08-11 01:15:01 UTC
Integrated into 'main-silver', will be available in build *201508110002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/8fe23bcf31e3
User: Svata Dedic <sdedic@netbeans.org>
Log: #247933: loop control conditions properly handled