Integrated: 8348906: InstanceOfTree#getType doesn't specify when it returns null
Jan Lahoda
jlahoda at openjdk.org
Tue May 20 02:42:57 UTC 2025
On Tue, 13 May 2025 11:29:11 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
This pull request has now been integrated.
Changeset: 39d8d109
Author: Jan Lahoda <jlahoda at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/39d8d109dd8ab300ff6579f8077468a6b02cfbda
Stats: 120 lines in 2 files changed: 113 ins; 0 del; 7 mod
8348906: InstanceOfTree#getType doesn't specify when it returns null
Reviewed-by: liach
-------------
PR: https://git.openjdk.org/jdk/pull/25205
More information about the compiler-dev
mailing list