Following #113 fixes were collected from the containing nonnull location in serialized errors. Previous to that PR fixes were read from the fixes.tsv serialized by NullAway and it was already skipping fixes for elements with explicit @Nonnull annotations. This PR enables annotator to follow the same logic and acknowledge existing @Nonnull annotations and prevent from adding @Nullable on such annotations.
The logic for detecting a @Nonnull annotations from its name is as below:
To pass a custom set of nonnull annotations, use flag below:
-nna, --nonnull-annotations : Adds a list of nonnull annotations separated by comma to be acknowledged by Annotator (e.g. com.example1.Nonnull,com.example2.Nonnull)
In this PR scanner serializes all elements with explicit @Nonnull annotations to nonnull_elements.tsv and informs annotator-core module from existing elements, then in the deserialization of errors, these locations are used and marked as unresolvable.
Please note that prior to this PR, scanner was only serializing outputs below:
Impacted regions
Existing methods
Existing classes flat names
This PR requires serialization of the exact location for elements with @Nonnull annotation, hence it uses the same API from NullAway (from location package) to serialize the exact location of an element. This the main reason that this is rather a large PR.
Following #113 fixes were collected from the containing
nonnull
location in serialized errors. Previous to that PR fixes were read from thefixes.tsv
serialized by NullAway and it was already skipping fixes for elements with explicit@Nonnull
annotations. This PR enables annotator to follow the same logic and acknowledge existing@Nonnull
annotations and prevent from adding@Nullable
on such annotations.The logic for detecting a
@Nonnull
annotations from its name is as below:To pass a custom set of nonnull annotations, use flag below:
In this PR scanner serializes all elements with explicit
@Nonnull
annotations tononnull_elements.tsv
and informs annotator-core module from existing elements, then in the deserialization of errors, these locations are used and marked as unresolvable.Please note that prior to this PR, scanner was only serializing outputs below:
This PR requires serialization of the exact location for elements with
@Nonnull
annotation, hence it uses the same API from NullAway (from location package) to serialize the exact location of an element. This the main reason that this is rather a large PR.