-
Enhancement
-
Resolution: Unresolved
-
P3
-
None
-
None
-
windows_7
A DESCRIPTION OF THE REQUEST :
All classes with a close() method should implement java.lang.AutoCloseable so try-with-resources (TWR) can be used.
e.g., java.util.logging.Handler has a close() method, yet it does not implement ava.lang.AutoCloseable.
I know that use cases wherein TWR will be useful for a Handler are limited, but I've actually run into one, and I don't see how a Handler implementing AutoCloseable would actually cause a problem.
JUSTIFICATION :
TWR is nice. It should be able to be used in more places.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
All classes with a close() method implementing java.lang.AutoCloseable.
ACTUAL -
Some classes with a close() method don't implement java.lang.AutoCloseable, e.g., java.util.logging.Handler.
CUSTOMER SUBMITTED WORKAROUND :
use try {} finally {} instead of TWR
All classes with a close() method should implement java.lang.AutoCloseable so try-with-resources (TWR) can be used.
e.g., java.util.logging.Handler has a close() method, yet it does not implement ava.lang.AutoCloseable.
I know that use cases wherein TWR will be useful for a Handler are limited, but I've actually run into one, and I don't see how a Handler implementing AutoCloseable would actually cause a problem.
JUSTIFICATION :
TWR is nice. It should be able to be used in more places.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
All classes with a close() method implementing java.lang.AutoCloseable.
ACTUAL -
Some classes with a close() method don't implement java.lang.AutoCloseable, e.g., java.util.logging.Handler.
CUSTOMER SUBMITTED WORKAROUND :
use try {} finally {} instead of TWR