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

Jan Lahoda jlahoda at openjdk.java.net
Mon Mar 15 18:05:24 UTC 2021


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.

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

Commit messages:
 - 8263589: Rawtypes warnings should be produced for pattern matching in instanceof

Changes: https://git.openjdk.java.net/jdk/pull/3016/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3016&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263590
  Stats: 17 lines in 3 files changed: 16 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3016.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3016/head:pull/3016

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


More information about the compiler-dev mailing list