You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Caused by: java.lang.ClassCastException: class com.sun.tools.javac.tree.JCTree$JCLiteral cannot be cast to class com.sun.source.tree.IdentifierTree (com.sun.tools.javac.tree.JCTree$JCLiteral and com.sun.source.tree.IdentifierTree are in module jdk.compiler of loader 'app')
at org.checkerframework.nullaway.dataflow.cfg.builder.CFGTranslationPhaseOne$SwitchBuilder.casesAreExhaustive(CFGTranslationPhaseOne.java:2565)
at org.checkerframework.nullaway.dataflow.cfg.builder.CFGTranslationPhaseOne$SwitchBuilder.build(CFGTranslationPhaseOne.java:2344)
at org.checkerframework.nullaway.dataflow.cfg.builder.CFGTranslationPhaseOne.visitSwitchExpression17(CFGTranslationPhaseOne.java:585)
at org.checkerframework.nullaway.dataflow.cfg.builder.CFGTranslationPhaseOne.scan(CFGTranslationPhaseOne.java:548)
at org.checkerframework.nullaway.dataflow.cfg.builder.CFGTranslationPhaseOne.visitReturn(CFGTranslationPhaseOne.java:3389)
Based on the JCLiteral type I'm guessing the issue is with case null. I'll work on putting together a test case, just wanted to report in case the root cause is obvious.
The text was updated successfully, but these errors were encountered:
msridhar
changed the title
Crash in CFG construction for switch expression on JDK 20
Crash in CFG construction for case null in switch expression
Sep 12, 2023
(Note using null in a case statement is a preview feature of Java 20, so I just used Java 21 to reproduce.)
Here's a testcase:
import org.checkerframework.checker.nullness.qual.Nullable;
public class Issue6173 {
static Object toGroupByQueryWithExtractor2(
@Nullable GroupBy groupBy) {
return switch (groupBy) {
case OWNER -> new Object();
case CHANNEL -> new Object();
case TOPIC -> new Object();
case TEAM -> new Object();
case null -> throw new IllegalArgumentException("GroupBy parameter is required");
};
}
public enum GroupBy {
OWNER,
CHANNEL,
TOPIC,
TEAM;
}
}
See uber/NullAway#831. Here is the code snippet:
The top of the crash stack is:
Based on the
JCLiteral
type I'm guessing the issue is withcase null
. I'll work on putting together a test case, just wanted to report in case the root cause is obvious.The text was updated successfully, but these errors were encountered: