ucr-riple / NullAwayAnnotator

A tool to help adapting code bases to NullAway type system.
MIT License
13 stars 6 forks source link

Update fix structor to contain multiple annotation changes #242

Closed nimakarimipour closed 2 weeks ago

nimakarimipour commented 2 weeks ago

This PR introduces a necessary change in preparation for the upcoming major PR that will add support for taint checker inference.

The key change in this PR is the update to the Fix structure, which now contains a list of changes rather than a single change. With this new design, a Fix instance represents the smallest unit of annotation changes that the Annotator will evaluate for its impact. If approved, these changes will be applied to the source code. It’s important to note that resolving an error may require adding multiple annotations, and a Fix instance can include a subset or all of these changes.

In NullAway inference, we evaluate each annotation individually and apply it if approved. For example, resolving an initialization error may require annotating multiple fields as @Nullable, but each annotation is evaluated and applied one at a time. In contrast, taint inference requires evaluating all suggested annotations together for a given error.

This updated design lays the groundwork for supporting the taint checker inference by accommodating the evaluation of grouped annotations for each error.