RFR: 8348906: InstanceOfTree#getType doesn't specify when it returns null [v2]

Jan Lahoda jlahoda at openjdk.org
Wed May 14 13:44:48 UTC 2025


> `InstanceOfTree.getType()` returns `null` if the `instanceof` uses a pattern different than the type test pattern. This is not documented, and should be documented. This PR proposes the documentation for this.
> 
> Alternatively, we could change `getType()` to return a type for other types of patterns, but the meaning of that is not quite clear even for record patterns, and it gets even less clear with the possible future patterns. I believe it has been mostly a conscious decision to not handle record patterns in this method. Possibly, it was a mistake to handle the type test/binding patterns in `getType()`, but that's not something that we should change, I think.
> 
> Please also review the CSR:
> https://bugs.openjdk.org/browse/JDK-8356857

Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:

  Reflecting review comment - adding examples.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25205/files
  - new: https://git.openjdk.org/jdk/pull/25205/files/11c94956..f8495d59

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25205&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25205&range=00-01

  Stats: 27 lines in 1 file changed: 20 ins; 0 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/25205.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25205/head:pull/25205

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


More information about the compiler-dev mailing list