[lombok] IDEA-326444 Fix handling of static fields already containing lombok annotation

GitOrigin-RevId: 6f6583bd542f2c3d2dd46858b61c9904d5781152
This commit is contained in:
Michail Plushnikov
2023-07-30 19:51:07 +02:00
committed by intellij-monorepo-bot
parent b8256fd542
commit c4210cf6d8
5 changed files with 37 additions and 1 deletions

View File

@@ -57,7 +57,7 @@ public abstract class LombokGetterOrSetterMayBeUsedInspection extends LombokJava
for (PsiField field : psiClass.getFields()) {
PsiAnnotation annotation = field.getAnnotation(getAnnotationName());
if (annotation != null) {
if (!annotation.getAttributes().isEmpty()) {
if (!annotation.getAttributes().isEmpty() || field.hasModifierProperty(PsiModifier.STATIC)) {
isLombokAnnotationAtClassLevel = false;
}
else {

View File

@@ -0,0 +1,9 @@
// "Use lombok @Getter for 'Foo'" "false"
import lombok.Getter;
public class Foo {
@Getter
private static char bar;
}

View File

@@ -0,0 +1,9 @@
// "Use lombok @Getter for 'Foo'" "false"
import lombok.Getter;
public class Foo<caret> {
@Getter
private static char bar;
}

View File

@@ -0,0 +1,9 @@
// "Use lombok @Setter for 'Foo'" "false"
import lombok.Setter;
public class Foo<caret> {
@Setter
private static char bar;
}

View File

@@ -0,0 +1,9 @@
// "Use lombok @Setter for 'Foo'" "false"
import lombok.Setter;
public class Foo<caret> {
@Setter
private static char bar;
}