[jdk17u-dev] RFR: 8281238: TYPE_USE annotations not printed in correct position in toString output

Liam Miller-Cushon cushon at openjdk.org
Tue Jan 27 10:37:56 UTC 2026


This backport of [JDK-8281238](https://bugs.openjdk.org/browse/JDK-8281238) fixes a bug in `TypeMirror#toString` output when printing type annotations.

`TypeMirror#toString` is specified to return a string that is "suitable for representing this type in source code". This fix causes type annotations on qualified names to be printed at the correct location, for example `java.lang. at Annotation String` instead of `@Annotation java.lang.String`.

There was a bug in the initial fix for JDK-8281238, follow-on fix [JDK-8284220](https://bugs.openjdk.org/browse/JDK-8284220) is included in this backport.

-------------

Commit messages:
 - Backport 4d30a1e8d1587c63e85950b7a61439b5bf98c689
 - Backport 4032fe76dccb6da85927361aee7ceedcdb758e89

Changes: https://git.openjdk.org/jdk17u-dev/pull/4242/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk17u-dev&pr=4242&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8281238
  Stats: 155 lines in 7 files changed: 142 ins; 0 del; 13 mod
  Patch: https://git.openjdk.org/jdk17u-dev/pull/4242.diff
  Fetch: git fetch https://git.openjdk.org/jdk17u-dev.git pull/4242/head:pull/4242

PR: https://git.openjdk.org/jdk17u-dev/pull/4242


More information about the jdk-updates-dev mailing list