redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 441 forks source link

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

Open gorankarlic opened 4 weeks ago

gorankarlic commented 4 weeks ago

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
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.