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 220691 - "Lock not unlocked in finally" not offered if lock and unlock are at different block levels
Summary: "Lock not unlocked in finally" not offered if lock and unlock are at differen...
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-23 19:09 UTC by chunkyks
Modified: 2016-11-25 04:05 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 chunkyks 2012-10-23 19:09:37 UTC
"Lock not unlocked in finally" isn't offered as a hint in the following code, where I believe it should be:

lock.lock();
try {
   do_some_work();
   lock.unlock();
} catch(Exception ex) {
}

As a human, I recognise the code should probably just have a "finally" clause added to the same try-catch block, and move the unlock into that. I don't know what the IDE hint would do.

Saliently, the point is that the hint misses that opportunity altogether.
Comment 1 Martin Balin 2016-07-07 07:16:38 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 2 chunkyks 2016-07-07 15:09:18 UTC
This still manifests as the original description has it.
Comment 3 Svata Dedic 2016-07-22 20:28:52 UTC
Added a few scenarios for unlock in jet-main#e638b41b6f4a
Comment 4 Quality Engineering 2016-07-26 01:51:09 UTC
Integrated into 'main-silver', will be available in build *201607260002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e638b41b6f4a
User: Svata Dedic <sdedic@netbeans.org>
Log: #220691: extended concurrent.Lock hints
Comment 5 chunkyks 2016-08-06 16:16:20 UTC
Confirming fixed, closing bug. Thank-you!
Comment 6 Quality Engineering 2016-11-25 04:05:03 UTC
Integrated into 'main-silver', will be available in build *201611250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6ff7388c41b3
User: Svata Dedic <sdedic@netbeans.org>
Log: #220691: fixed tests