JDK-8336754 : Remodel TypeAnnotation to "has" instead of "be" an Annotation
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.classfile
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-07-18
  • Updated: 2024-08-26
  • Resolved: 2024-08-16
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 24
24 b12Fixed
Related Reports
Blocks :  
CSR :  
Relates :  
Description
`java.lang.classfile.TypeAnnotation` currently extends `Annotation`. This opens up opportunities for misuse, such as passing a `TypeAnnotation` into `AnnotationValue.OfAnnotation`, where the type information will be lost. And this modeling causes some difficulty in writing to bytes.

Therefore, I suggest remodeling `TypeAnnotation` to have an `Annotation annotation()` method to prevent such problems.
Comments
Changeset: 961e944f Branch: master Author: Chen Liang <liach@openjdk.org> Date: 2024-08-16 15:48:54 +0000 URL: https://git.openjdk.org/jdk/commit/961e944fa731dc84be2764c01e4b326187474605
16-08-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20247 Date: 2024-07-19 01:55:57 +0000
23-07-2024