31d0896a8b
The API change requires adding a "context" parameter to NodeLintRule.registerNodeProcessors. If we did this naively it would be a breaking change since the existing linter code overrides this method with an implementation that doesn't accept such a parameter. So to avoid making this a breaking change, we introduce a new interface NodeLintRuleWithContext that extends NodeLintRule, and adds the context to the registerNodeProcessors method as an optional parameter. The analyzer will only pass in the new parameter if the lint rule implements the new interface; otherwise it will call the method in the old way. This will allow the linter to be migrated to use the new API at its pace. The next breaking change version of the analyzer will change both NodeLintRule and NodeLintRuleWithContext so that the context parameter is required, and will pass in a context unconditionally. At a later date, after the linter has been fully migrated to the new analyzer version, we will be able to switch back to NodeLintRule and deprecate NodeLintRuleWithContext. Change-Id: I75ada0e94e26f831d6f2cb82cddfa706100eb185 Reviewed-on: https://dart-review.googlesource.com/c/82522 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Phil Quitslund <pquitslund@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Paul Berry <paulberry@google.com>