Skip to content

JSpecify: False negative when overriding narrows @Nullable type variable bound #1512

@HildingLinden

Description

@HildingLinden

The following code passes using NullAway 0.13.1 in JSpecify mode.

@NullMarked
interface Foo {
    <T extends @Nullable Object> void bar( T arg );
}

@NullMarked
class Baz implements Foo {
    @Override
    public <T> void bar( T arg ) {}
}

This looks like a false negative: the override narrows the method type variable bound from <T extends @Nullable Object> to <T>, even though T is used in parameter position. No diagnostic is reported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugjspecifyRelated to support for jspecify standard (see jspecify.dev)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions