Skip to content

Unboxing may produce NullPointerException #1162

@violetagg

Description

@violetagg

I have a use case where I want to use Long.hashCode(long value).
When I'm invoking it with Long that is actually null, I'm receiving NullPointerException.
NullAway does not provide any warning that the unboxing may produce NullPointerException.

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.lang.Long.longValue()" because "a.longValue" is null

Reproducible example is available here https://github.com/violetagg/nullaway-unboxing, you need to run the org.example.Main#main

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