-
Bug
-
Resolution: Unresolved
-
P5
-
None
-
None
-
None
The OptionalDataException class differs from established conventions for exception classes in a couple ways:
1. it has no public constructors
2. it has public, writable fields
We should reconsider cleaning up this class. This was previously considered inJDK-8168101 which was closed because there was no compelling rationale to fix it. That may indeed have been the case; however, this exception class is a notable outlier compared to almost every other exception class in the system. Because it differs from established patterns, this class is flagged by various static detectors such as the one used by JDK-8283414.
Public constructors could be added without much difficulty.
Getters for the fields could be added, and the fields removed (possibly after deprecation). A middle ground might be to make the fields final. Some corpus searching might be of use to determine the degree of incompatibility.
1. it has no public constructors
2. it has public, writable fields
We should reconsider cleaning up this class. This was previously considered in
Public constructors could be added without much difficulty.
Getters for the fields could be added, and the fields removed (possibly after deprecation). A middle ground might be to make the fields final. Some corpus searching might be of use to determine the degree of incompatibility.
- relates to
-
JDK-8168101 java.io.OptionalDataException should have public constructors
- Closed
-
JDK-8283414 Update java.base to use sealed classes (umbrella)
- Closed