Skip to content

NullAway 0.13.6 no longer flags uninitialized JPA property missing @Nullable #1602

Description

@jeffrey-easyesi
import jakarta.persistence.*;
@Entity
@org.jspecify.annotations.NullMarked
public class TestEntity {
    private String name;
    private String extraInfo;

    public TestEntity() {} // for JPA
    public TestEntity(String name) { this.name = name; }

    @Id
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public String getExtraInfo() { return extraInfo; }
    public void setExtraInfo(String s) { this.extraInfo = s; }
}

NullAway 0.13.4 correctly warns on the uninitialized non-null field extraInfo, which ought to be @Nullable.
(It also complains about the no-arg constructor, but that's easily fixed with NullAway:ExternalInitAnnotations=jakarta.persistence.Entity.)

NullAway 0.13.6 allows extraInfo to be unannotated, even though it probably isn't set for all objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions