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

False-positive when dereferencing an inline-initialized field from constructor body #1135

Open
agrieve opened this issue Jan 28, 2025 · 1 comment

Comments

@agrieve
Copy link

agrieve commented Jan 28, 2025

@NullMarked
class Foo {
    private @Nullable Object mArgs = new Object();

    Foo() {
        mArgs.getClass();
    }
}

Gives:

Foo.java:9: warning: [NullAway] dereferenced expression mArgs is @Nullable
        mArgs.getClass();
             ^
    (see http://t.uber.com/nullaway )
@msridhar
Copy link
Collaborator

I can reproduce this and I think we should handle it. It'll take a bit of time to do the implementation required.

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

2 participants