JDK-8042981 : Strip type annotations in Types' utility methods
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.lang.model
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-05-12
  • Updated: 2024-10-17
  • Resolved: 2024-01-26
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 23
23 b08Fixed
Related Reports
CSR :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
In javax.lang.model.util.Types, there are nine methods that process TypeMirror arguments (or wrappers thereof) and produce a TypeMirror in return:

- asMemberOf
- capture
- directSupertypes
- erasure
- getArrayType
- getDeclaredType x2
- getWildcardType
- unboxedType 

Per [1], it is desirable to ensure that no type annotations appear in the returned TypeMirror objects (when viewed as AnnotatedConstruct objects). jx.l.m.u.Types should say: "Utility methods for operating on types. Where a method returns a TypeMirror, the TypeMirror represents a type with no type annotations."

[1] http://mail.openjdk.java.net/pipermail/compiler-dev/2014-May/008756.html
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/8984 Date: 2022-06-02 01:09:17 +0000
17-10-2024

Changeset: ed3272cc Author: Joe Darcy <darcy@openjdk.org> Date: 2024-01-26 20:55:46 +0000 URL: https://git.openjdk.org/jdk/commit/ed3272cc44a5b1ae918b573e6c3d792665b6bbc7
26-01-2024

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/8984 Date: 2022-06-02 01:09:17 +0000
02-06-2022

The implementation in javac has *not* been stripping annotations, even after the fix for JDK-8031744. For better risk management, deferring from 9 to 10 to leave more time to assess feedback on the implementation change.
09-02-2017

Several of the listed methods have explicit calls to strip annotations (introduced by JDK-8031744): check - asMemberOf strips- capture strips- directSupertypes strips- erasure check - getArrayType check - getDeclaredType x2 check - getWildcardType check - unboxedType
07-02-2017

The specification on this point should be clarified, as long as the reference implementation adjusted.
14-05-2014