Skip to content

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

@agrieve

Description

@agrieve
@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 )

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions