Skip to content

Add @Value to the list of default initializers #1483

@WoutDeleu

Description

@WoutDeleu

I see that https://github.com/uber/NullAway/blob/master/nullaway/src/main/java/com/uber/nullaway/ErrorProneCLIFlagsConfig.java#L177 has support for things like @Autowired and @MockitoBean. Can we add @value also to this list for Value injections in Test or in the constructor?

As a workaround, I currently suppress the error like this:

  @SuppressWarnings("NullAway.Init")
  @Value
  String a;

or, as an alternative, to do it globally using a maven argument: -XepOpt:NullAway:ExcludedFieldAnnotations=org.springframework.beans.factory.annotation.Value

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