RFR: 8269113: Javac throws when compiling switch (null)

Jan Lahoda jlahoda at openjdk.java.net
Mon Sep 27 11:25:18 UTC 2021

This handles a case of `switch (null)` (i.e. switch over a literal `null`). It is necessary to handle `BOT` (null type) in the switch's selector, similarly to how it is handled in `null instanceof ...`. Note that since any reference type is a supertype of the `null` (JLS 4.10.2.), any type pattern is total for `switch (null)`.


Commit messages:
 - Removing debug code.
 - 8269113: Javac throws when compiling switch (null)

Changes: https://git.openjdk.java.net/jdk/pull/5713/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5713&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8269113
  Stats: 45 lines in 4 files changed: 40 ins; 2 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5713.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5713/head:pull/5713

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

More information about the compiler-dev mailing list