ucr-riple / NullAwayAnnotator

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

Add local variable injection #163

Closed nimakarimipour closed 1 year ago

nimakarimipour commented 1 year ago

This PR is build on #170 and #171 and cannot land before them.

This PR adds support for applying changes on local variables declared in methods.

To locate a local variable declaration expression node in the AST, information below must be passed to injector:

  1. Flat name of the enclosing class.
  2. Method signature of the first enclosing method.
  3. Local variable name.

With these information, injector is able to locate the variable declaration expression and apply the requested changes.

Annotations on local variables will be applied on the declaration and all its type arguments if exists: For instance: Foo<Bar, Map<Bar, Bar>> baz Will be annotated as: @Annot Foo<@Annot Bar, @Annot Map<@Annot Bar, @Annot Bar>> baz

nimakarimipour commented 1 year ago

Sine this PR is too old to rebase, I will close this and open a fresh one instead.