From 92e9bda2e880de57a76b3a1d6be10c0816c35c75 Mon Sep 17 00:00:00 2001 From: Michail Plushnikov Date: Thu, 24 Sep 2020 21:10:03 +0200 Subject: [PATCH] backport changes/adapted changelog --- parts/pluginChanges.html | 1 - .../plugin/extension/LombokHighlightErrorFilter.java | 5 ++--- .../intellij/plugin/processor/ValProcessor.java | 2 +- .../plugin/provider/LombokAugmentProvider.java | 11 ----------- src/main/resources/messages/lombokBundle.properties | 1 - 5 files changed, 3 insertions(+), 17 deletions(-) diff --git a/parts/pluginChanges.html b/parts/pluginChanges.html index 8daf72256..9632fc289 100644 --- a/parts/pluginChanges.html +++ b/parts/pluginChanges.html @@ -2,7 +2,6 @@
  • 0.32
    1. Fixed #761: EqualsAndHashCode: Wrong warning 'A method with one of those names already exists'
    2. -
    3. Fixed #802: [Only for IntelliJ>=2020.3] val mis-infers an Optional(T) as Optional(Object) after map.
    4. Fixed #826: Error if using @FieldNameConstants in switch case
    5. Fixed #858: Delombok produces duplicate @NonNull annotations on setters/getters
    6. Fixed #933: Enable annotation processing warning showing everytime project is opened
    7. diff --git a/src/main/java/de/plushnikov/intellij/plugin/extension/LombokHighlightErrorFilter.java b/src/main/java/de/plushnikov/intellij/plugin/extension/LombokHighlightErrorFilter.java index 1023ce721..57fb425a6 100644 --- a/src/main/java/de/plushnikov/intellij/plugin/extension/LombokHighlightErrorFilter.java +++ b/src/main/java/de/plushnikov/intellij/plugin/extension/LombokHighlightErrorFilter.java @@ -1,6 +1,5 @@ package de.plushnikov.intellij.plugin.extension; -import com.intellij.codeInsight.daemon.JavaErrorBundle; import com.intellij.codeInsight.daemon.impl.HighlightInfo; import com.intellij.codeInsight.daemon.impl.HighlightInfoFilter; import com.intellij.codeInsight.intention.AddAnnotationFix; @@ -17,7 +16,6 @@ import java.util.*; import java.util.regex.Pattern; - public class LombokHighlightErrorFilter implements HighlightInfoFilter { private static final Pattern LOMBOK_ANY_ANNOTATION_REQUIRED = Pattern.compile("Incompatible types\\. Found: '__*', required: 'lombok.*AnyAnnotation\\[\\]'"); @@ -144,7 +142,8 @@ public boolean accept(@NotNull PsiElement highlightedElement) { CONSTANT_EXPRESSION_REQUIRED(HighlightSeverity.ERROR, CodeInsightColors.ERRORS_ATTRIBUTES) { @Override public boolean descriptionCheck(@Nullable String description) { - return JavaErrorBundle.message("constant.expression.required").equals(description); +// message("constant.expression.required") + return "Constant expression required".equals(description); } @Override diff --git a/src/main/java/de/plushnikov/intellij/plugin/processor/ValProcessor.java b/src/main/java/de/plushnikov/intellij/plugin/processor/ValProcessor.java index dfcc77aae..fabaf809f 100644 --- a/src/main/java/de/plushnikov/intellij/plugin/processor/ValProcessor.java +++ b/src/main/java/de/plushnikov/intellij/plugin/processor/ValProcessor.java @@ -183,7 +183,7 @@ public void verifyParameter(@NotNull final PsiParameter psiParameter, @NotNull f } } - public boolean canInferType(@NotNull PsiTypeElement typeElement) { + private boolean canInferType(@NotNull PsiTypeElement typeElement) { final PsiElement parent = typeElement.getParent(); return (parent instanceof PsiLocalVariable && isValOrVar((PsiLocalVariable) parent)) || (parent instanceof PsiParameter && isValOrVarForEach((PsiParameter) parent)); diff --git a/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAugmentProvider.java b/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAugmentProvider.java index bc665642f..85956ed0f 100644 --- a/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAugmentProvider.java +++ b/src/main/java/de/plushnikov/intellij/plugin/provider/LombokAugmentProvider.java @@ -54,17 +54,6 @@ protected Set transformModifiers(@NotNull PsiModifierList modifierList, return result; } - /** - * This method should be available in the next IntelliJ 203 Release - */ - // @Override - public boolean canInferType(@NotNull PsiTypeElement typeElement) { - if (!valProcessor.isEnabled(typeElement.getProject())) { - return false; - } - return valProcessor.canInferType(typeElement); - } - @Nullable @Override protected PsiType inferType(@NotNull PsiTypeElement typeElement) { diff --git a/src/main/resources/messages/lombokBundle.properties b/src/main/resources/messages/lombokBundle.properties index 6efa96fe2..25af7570f 100644 --- a/src/main/resources/messages/lombokBundle.properties +++ b/src/main/resources/messages/lombokBundle.properties @@ -21,7 +21,6 @@ daemon.donate.content=
      \ Helpful? Donate with PayPal

      \ Fixes:
      \ - Fixed (#761): EqualsAndHashCode: Wrong warning 'A method with one of those names already exists'
      \ -- Fixed (#802): val mis-infers an Optional(T) as Optional(Object) after map. Only for IntelliJ>=2020.3
      \ - Fixed (#826): Error if using @FieldNameConstants in switch case
      \ - Fixed (#858): Delombok produces duplicate @NonNull annotations on setters/getters
      \ - Fixed (#933): Enable annotation processing warning showing everytime project is opened
      \