[java-highlighting] Use 'SetVariableTypeFix' for the "The receiver type does not match the enclosing class type" error

GitOrigin-RevId: f60f37d148c81dfe0fb86d56a385c2561ad9bb07
This commit is contained in:
Andrey.Cherkasov
2022-02-08 01:01:43 +00:00
committed by intellij-monorepo-bot
parent c32ee0edf2
commit 475eaf4754
3 changed files with 17 additions and 11 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInsight.intention.impl.config;
import com.intellij.codeInsight.CodeInsightWorkspaceSettings;
@@ -1052,17 +1052,23 @@ public final class QuickFixFactoryImpl extends QuickFixFactory {
@Override
public @NotNull IntentionAction createReceiverParameterTypeFix(@NotNull PsiReceiverParameter receiverParameter,
@NotNull PsiType enclosingClassType) {
return new VariableTypeFix(receiverParameter, enclosingClassType) {
@Override
public @NotNull String getText() {
return QuickFixBundle.message("fix.receiver.parameter.type.text");
}
return new ReceiverParameterTypeFix(receiverParameter, enclosingClassType);
}
@Override
public @NotNull String getFamilyName() {
return QuickFixBundle.message("fix.receiver.parameter.type.family");
}
};
private final static class ReceiverParameterTypeFix extends SetVariableTypeFix {
private ReceiverParameterTypeFix(@NotNull PsiReceiverParameter receiverParameter, @NotNull PsiType enclosingClassType) {
super(receiverParameter, enclosingClassType);
}
@Override
public @NotNull String getText() {
return QuickFixBundle.message("fix.receiver.parameter.type.text");
}
@Override
public @NotNull String getFamilyName() {
return QuickFixBundle.message("fix.receiver.parameter.type.family");
}
}
@Override