ucr-riple / NullAwayAnnotator

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

Optimize field registry population mechanism by parsing each source file only once #230

Closed nimakarimipour closed 6 months ago

nimakarimipour commented 6 months ago

In FieldRegistryPopulation we process a single compilation unit tree multiple times as this method receives a pair of a class flat name and a path to source file containing that class, hence, for compilation unit trees that contains multiple classes, inner classes and anonymous classes we parse the same source file multiple times. This PR updates this mechanism by caching the latest parsed source file. This optimization is according to the assumption that Scanner visits all classes within a single compilation unit tree consecutively.