Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gorankarlic opened this issue Oct 25, 2024 · 0 comments
Open

Comments

@gorankarlic
Copy link

gorankarlic commented Oct 25, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant