Skip to content

Commit ea4c6df

Browse files
cushonError Prone Team
authored andcommitted
Avoid calling SuggestedFixes.compilesWithFix in FieldCanBeFinal
`SuggestedFixes.compilesWithFix` re-parses and re-attributes the entire compilation unit for each candidate field, which can be slow on large files with many candidate fields that are conditionally initialized. Instead, check that blank candidate fields are initialized once in straight-line code (including plain blocks and `catch`-less `try` blocks) in the class or instance initializer or in every non-delegating constructor, before any reads of the field or `return` statements. Fields initialized across branching control flow (such as `if`/`else`) are no longer matched. PiperOrigin-RevId: 1012050702
1 parent 04640b8 commit ea4c6df

2 files changed

Lines changed: 868 additions & 30 deletions

File tree

0 commit comments

Comments
 (0)