RFR: 8273263: Incorrect recovery attribution of record component type when j.l.Record is unavailable

Jan Lahoda jlahoda at openjdk.java.net
Thu Sep 2 11:01:44 UTC 2021


This is a little obscure case where `j.l.Record` is not available, yet the source code contains a record, the AST model is slightly broken - the first record's component has an erroneous type. The reason is that `syms.recordType` is used directly, and when it is completed (for the first time), the `CompletionFailure` thrown will break the component's type. It would be better to report the error on the proper place at a proper place. This is already done for enums, where the supertype is attributed from an AST, which reports any errors at an appropriate place. The proposal in this patch is to also create a temporary AST for `j.l.Record` and attribute it, so that the errors are reported at an appropriate time and place.

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

Commit messages:
 - 8273263: Incorrect recovery attribution of record component type when j.l.Record is unavailable

Changes: https://git.openjdk.java.net/jdk/pull/5349/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5349&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8273263
  Stats: 51 lines in 3 files changed: 49 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5349.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5349/head:pull/5349

PR: https://git.openjdk.java.net/jdk/pull/5349


More information about the compiler-dev mailing list