RFR: 8333169: javac NullPointerException record.type

Jan Lahoda jlahoda at openjdk.org
Fri May 31 10:36:24 UTC 2024


While attributing cases, `Attr` computes `completesNormally`, by invoking `Flow`. It will do `preFlow` before running the `Flow`, to make fill in missing types/symbols in the AST, as `Flow` generally requires them. But, the visitor filling the types is missing code to fill in the missing type for record patterns, and consequently `Flow` may crash on record pattern while computing `completesNormally`.

The proposal herein is to adjust the visitor to fill in the missing attributes for record patterns, as is done for other AST nodes.

I've also filled a follow-up to reconsider computing `completesNormally` in `Attr`, to get more performance. This will require moving some of the checks that are currently done in `Attr` to `Flow`, but it would probably pay off:
https://bugs.openjdk.org/browse/JDK-8333333

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

Commit messages:
 - Also filling record and component types.
 - 8333169: javac NullPointerException record.type

Changes: https://git.openjdk.org/jdk/pull/19498/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19498&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8333169
  Stats: 43 lines in 2 files changed: 42 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/19498.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19498/head:pull/19498

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


More information about the compiler-dev mailing list