Skip to content

Checking of boxed primitives (e.g. Double) for case null with JEP 441 #3830

@gorankarlic

Description

@gorankarlic

Does not properly support checking of boxed Double or Float for case null with JEP 441 pattern switching. Instead it shows Case constants in a switch on 'Double' must have type 'double' Java(2099252).

Environment
  • Operating System: MacOS 15.0.1
  • JDK version: JDK 21
  • Visual Studio Code version: Version: 1.94.2 (Universal)
  • Java extension version: v1.35.1
Steps To Reproduce
public class Test
{
    public static void main(final String[] args)
    {
        switch(Double.valueOf(1.0))
        {
            case null -> System.out.println("is null");
            default -> System.out.println("is not null");
        }
    }
}
Current Result

This displays the following error in VSCode:

Case constants in a switch on 'Double' must have type 'double' Java(2099252)
Expected Result

As Java 21 compiles and runs the above code it should not show an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions