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 247915 - FileLock could implement AutoCloseable
Summary: FileLock could implement AutoCloseable
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2014-10-14 09:43 UTC by Svata Dedic
Modified: 2014-11-24 11:24 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Proposed changes (3.18 KB, patch)
2014-10-14 09:47 UTC, Svata Dedic
Details | Diff
Revised patch with Y01-3 (5.82 KB, patch)
2014-10-14 11:03 UTC, Svata Dedic
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Svata Dedic 2014-10-14 09:43:38 UTC
Since we already require JDK 1.7 to compile NetBeans platform, FileLock class could finally implement AutoCloseable to nicely play in try-with-resources clauses.
Comment 1 Svata Dedic 2014-10-14 09:47:31 UTC
Created attachment 149888 [details]
Proposed changes
Comment 2 Jaroslav Tulach 2014-10-14 10:43:46 UTC
Y01 "As JDK 1.7 is required, the FileLock can implement AutoCloseable" - nice explanation of the motivation, but I guess it belongs more into the review issue than into the change description. Just state the fact it implements the interface to be usable in try/catch/with/resources.

Y02 Adding final method can be seen as binary incompatible change. Unlikely to cause harm, but consider non-final close() method.

Y03 Change one test in the TCK to use the close() method instead of releaseLock(), please.
Comment 3 Svata Dedic 2014-10-14 11:03:46 UTC
Created attachment 149892 [details]
Revised patch with Y01-3
Comment 4 Svata Dedic 2014-10-27 10:09:53 UTC
If there is no further input, I'll integrate on 29/10
Comment 5 Quality Engineering 2014-11-21 03:51:05 UTC
Integrated into 'main-silver', will be available in build *201411210001* on (upload may still be in progress)

User: Svata Dedic <>
Log: #247915: implemented AutoCloseable support