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

NullPointerException in InstanceOfAndCastMatchWrongType #4168

Open
anthonyvdotbe opened this issue Oct 29, 2023 · 0 comments
Open

NullPointerException in InstanceOfAndCastMatchWrongType #4168

anthonyvdotbe opened this issue Oct 29, 2023 · 0 comments

Comments

@anthonyvdotbe
Copy link
Contributor

Similar to #4167

error-prone version: 2.23.0
BugPattern: InstanceOfAndCastMatchWrongType
Stack Trace:
java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.code.Type.isPrimitive()" because "t" is null

The snippet on which it failed looks like:

if(baz instanceof Foo.Bar.Baz(String text, Locale locale, Charset charset)) {

    Some.staticMethod((Foo.Bar.Baz) baz, unrelated); // <-- NullPointerException on this line

}

where Foo is an enum, Bar a sealed interface and Baz a record that implements Bar.

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