RFR: 8334055: Unhelpful 'required: reference' diagnostics after JDK-8043226

Liam Miller-Cushon cushon at openjdk.org
Wed Jun 12 16:46:37 UTC 2024


Please consider this fix for [JDK-8334055: Unhelpful 'required: reference' diagnostics after JDK-8043226](https://bugs.openjdk.org/browse/JDK-8334055), which partially reverts some logic originally added by the fix for [JDK-8043226](https://bugs.openjdk.org/browse/JDK-8043226).

The core of JDK-8043226 is preserved, improved diagnostics are still reported where 'scoping construct cannot be annotated' diagnostics were emitted previously.

The reverted logic affects attribution of type annotations on package names, which was intended to enable better diagnostics, but also affected diagnostics for type annotations on missing symbols.


CantAnnotateMissingSymbol.java:12: error: unexpected type
    List<@TA NoSuch> x;
         ^
  required: reference
  found:    NoSuch


The restored behavior is:


CantAnnotateMissingSymbol.java:12: error: cannot find symbol
    List<@TA NoSuch> x;
             ^
  symbol:   class NoSuch
  location: class CantAnnotateMissingSymbol

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

Commit messages:
 - Add a regression test
 - 8334055: Unhelpful 'required: reference' diagnostics after JDK-8043226

Changes: https://git.openjdk.org/jdk/pull/19667/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19667&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8334055
  Stats: 41 lines in 7 files changed: 23 ins; 13 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/19667.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19667/head:pull/19667

PR: https://git.openjdk.org/jdk/pull/19667


More information about the compiler-dev mailing list