Fix AutoCorrection crashing with Missing extension point #4545
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #4003
Fixes #4500
Fixes #4489
This issue was apparently caused by my PR #3848
What is happening is that KtLint is enabling AST mutation on the Root Extension, while we're not. Therefore, as the
autoCorrect
tries to mutate the AST it crashes with the mentioned message.Moreover there was a
!
missing which was causing the code to do nothing. I've also removed thesyncronized
as KtLint is not using it either.I've tested locally with a SNAPSHOT version and it works for me. I'm unsure how we can test this with an automated test.
Sadly we will have to live with the deprecated
getRootArea()
. KtLint is having that as well so I guess they'll find a way if JetBrains decides to remove this API (and we'll have to follow their approach).