[kotlin] K2 J2K: Move VarToValProcessing LocalVarToValInspectionBasedProcessing and fixValToVarDiagnosticBasedProcessing to JKTree #2726
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.
Removing VarToValProcessing LocalVarToValInspectionBasedProcessing and fixValToVarDiagnosticBasedProcessing from the postprocessor to make it more compatible with K2.
To do this, we will add mutability logic to the JKField class member conversion phase. Now, we will return IMMUTABLE for any private vars that do not have writable logic and are not JPA qualified. Note that StubExpressions are allowed to have 1 write, since this would be the initial assignment of the field.
This is consistently correct with when it has
val
, however it sometimes hasvar
when it should beval
. I have run out of ideas for ways to fix these false positives, and adding back theVarToValPostprocessing
doesn't work because that consistently overcorrects (and was relying on the diagnostics to later revert back). For now, putting this up as a draft PR.@abelkov @darthorimar @ermattt
(This is a simplification of #2702 because I deeply messed up the merge. Please see comments there for additional context)