mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ModifierFix: disable for synthetic elements (e.g. record fields)
GitOrigin-RevId: e7e9f4ef09ccadcb85321e98fa8980bcfba8f8fd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
21cc3d6654
commit
1cedfe2417
@@ -118,6 +118,7 @@ public class ModifierFix extends LocalQuickFixAndIntentionActionOnPsiElement {
|
||||
PsiVariable variable = myVariable == null ? null : myVariable.getElement();
|
||||
boolean isAvailable = BaseIntentionAction.canModify(modifierList) &&
|
||||
modifierList.hasExplicitModifier(myModifier) != myShouldHave &&
|
||||
!(variable instanceof SyntheticElement) &&
|
||||
(variable == null || variable.isValid());
|
||||
|
||||
if (isAvailable && myShowContainingClass && editor != null) {
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Make 'Point.x' not final" "false"
|
||||
public record Point(int x, int y, long depth) {
|
||||
|
||||
public Point(int x, int y) {
|
||||
this(x, y, 10);
|
||||
this.<caret>x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Make 'Point.x' not final" "false"
|
||||
public record Point(int x, int y, long depth) {
|
||||
|
||||
public void setX(int x) {
|
||||
this.<caret>x = x;
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.java.codeInsight.daemon.quickFix;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Modifier14Test extends LightQuickFixParameterizedTestCase {
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "/codeInsight/daemonCodeAnalyzer/quickFix/modifier14";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return LightJavaCodeInsightFixtureTestCase.JAVA_14;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user