Skip to content

False positive for java 21 switch case with null, default #22040

Description

@erfri1

Version

CodeQL CLI: 2.25.6
github/codeql-action: v3
JDK: 21
OS: ubuntu-latest

What happened?

CodeQL Java extraction fails on valid Java 21 switch syntax.

Error:

  • Unable to parse source file: .../PrintixService.java
  • Parse error at line 84 column 23: Syntax error on token "default", invalid Expression

Then finalize fails with:

  • "CodeQL detected code written in Java/Kotlin but could not process any of it."
  • exit code 32

Minimal reproducible example

static String f(Object x) {
  return switch (x) {
    case null, default -> "v";
  };
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions