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

Chen Liang liach at openjdk.org
Mon May 19 10:55:53 UTC 2025


On Wed, 14 May 2025 13:44:48 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> `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.

Looks much more informative now.

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

Marked as reviewed by liach (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25205#pullrequestreview-2850327178


More information about the compiler-dev mailing list