JDK-7020499 : Project Coin: improvements to try-with-resources desugaring
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-02-18
  • Updated: 2016-04-28
  • Resolved: 2016-04-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b116Fixed
Related Reports
Relates :  
Relates :  
Description
Various improvements to the javac implementation of the try-with-resources desugaring have been suggested:

1) Generate a per-class helper method to encapsulate the if-primary-exception not-null... logic of the synthesized finally block.  (Unfortunately, such code cannot be shared in a common library method because the more precise exception information cannot be captured in the method's signature.)

2) From coin-dev ( http://mail.openjdk.java.net/pipermail/coin-dev/2011-February/003079.html ), omit the null-check on a resource if the resource is initialized with a constructor call since constructors cannot return null.

These should be considered in the future.

Comments
EVALUATION Yes.
07-09-2011