RFR: 8263590: Rawtypes warnings should be produced for pattern matching in instanceof

Maurizio Cimadamore mcimadamore at openjdk.java.net
Mon Mar 15 18:13:10 UTC 2021


On Mon, 15 Mar 2021 17:59:33 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> For code like:
> Object o = null;
> boolean b = o instanceof List l;
> 
> There should be a raw-type warning for `List`, as we are effectively declaring a variable with a raw type.
> 
> Code like:
> Object o = null;
> boolean b = o instanceof List;
> 
> Will not produce a warning (as it doesn't so far), as the (raw) type is not used in a problematic context.

Looks good!

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

Marked as reviewed by mcimadamore (Reviewer).

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


More information about the compiler-dev mailing list