mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
[lombok] IDEA-322276 IDEA-322260 make lombok inspection highlighting less verbose
GitOrigin-RevId: 4678b61b0a8700553f83d1838d5a92f5c7ba0717
This commit is contained in:
committed by
intellij-monorepo-bot
parent
54e6fcb1cd
commit
5aa3d88201
@@ -1,10 +1,7 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package de.plushnikov.intellij.plugin.inspection;
|
||||
|
||||
import com.intellij.codeInspection.CleanupLocalInspectionTool;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.*;
|
||||
@@ -192,9 +189,13 @@ public class LombokGetterMayBeUsedInspection extends LombokJavaInspectionBase im
|
||||
) {
|
||||
if (myHolder != null) {
|
||||
final LocalQuickFix fix = new LombokGetterMayBeUsedFix(Objects.requireNonNull(psiClass.getName()));
|
||||
final PsiIdentifier psiClassNameIdentifier = psiClass.getNameIdentifier();
|
||||
myHolder.registerProblem(psiClass,
|
||||
LombokBundle.message("inspection.lombok.getter.may.be.used.display.class.message",
|
||||
psiClass.getName()), fix);
|
||||
psiClass.getName()),
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
psiClassNameIdentifier != null ? psiClassNameIdentifier.getTextRangeInParent() : psiClass.getTextRange(),
|
||||
fix);
|
||||
} else if (lombokGetterMayBeUsedFix != null) {
|
||||
lombokGetterMayBeUsedFix.effectivelyDoFix(psiClass, fieldsAndMethods, annotatedFields);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
<warning descr="Class 'FieldsWithGetter' may use Lombok @Getter">public class FieldsWithGetter {
|
||||
public class <warning descr="Class 'FieldsWithGetter' may use Lombok @Getter">FieldsWithGetter</warning> {
|
||||
private int bar;
|
||||
|
||||
public int getBar() {
|
||||
@@ -24,7 +24,7 @@
|
||||
return InstanceField.this.fooBar;
|
||||
}</warning>
|
||||
}
|
||||
<warning descr="Class 'AllInstanceFields' may use Lombok @Getter">public class AllInstanceFields {
|
||||
public class <warning descr="Class 'AllInstanceFields' may use Lombok @Getter">AllInstanceFields</warning> {
|
||||
private int bar;
|
||||
private boolean Baz;
|
||||
private int fooBar;
|
||||
@@ -41,7 +41,7 @@
|
||||
public int getFooBar() {
|
||||
return AllInstanceFields.this.fooBar;
|
||||
}
|
||||
}</warning>
|
||||
}
|
||||
public class StaticField {
|
||||
private static int bar;
|
||||
private int fieldWithoutGetter;
|
||||
@@ -50,4 +50,4 @@
|
||||
return bar;
|
||||
}</warning>
|
||||
}
|
||||
}</warning>
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
<warning descr="Class 'InstanceAndStaticFields' may use Lombok @Getter">public class InstanceAndStaticFields {
|
||||
public class <warning descr="Class 'InstanceAndStaticFields' may use Lombok @Getter">InstanceAndStaticFields</warning> {
|
||||
private static int staticField;
|
||||
private int instanceField;
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
public int getInstanceField() {
|
||||
return instanceField;
|
||||
}
|
||||
}</warning>
|
||||
}
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class ClassWithAnnotatedField {
|
||||
public class ClassWithAnnotatedField<caret> {
|
||||
private int canditateField;
|
||||
@Getter
|
||||
private int annotatedField;
|
||||
|
||||
public int getCanditateField() {
|
||||
return canditateField<caret>;
|
||||
return canditateField;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
// "Use lombok @Getter for 'InnerClass'" "true"
|
||||
|
||||
public class Foo {
|
||||
public class InnerClass {
|
||||
public class InnerClass<caret> {
|
||||
private int bar;
|
||||
|
||||
public int getBar() {
|
||||
return bar<caret>; // Keep this comment
|
||||
return bar; // Keep this comment
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user