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

Summary: FileLock could implement AutoCloseable
Product: platform Reporter: Svata Dedic <sdedic>
Component: FilesystemsAssignee: Svata Dedic <sdedic>
Status: RESOLVED FIXED    
Severity: normal CC: apireviews, tmysik
Priority: P3 Keywords: API_REVIEW, API_REVIEW_FAST
Version: 8.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Proposed changes
Revised patch with Y01-3

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 http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/5d7691d3f865
User: Svata Dedic <sdedic@netbeans.org>
Log: #247915: implemented AutoCloseable support