diff --git a/java/java-impl/src/com/intellij/spellchecker/JavaSpellcheckingStrategy.java b/java/java-impl/src/com/intellij/spellchecker/JavaSpellcheckingStrategy.java index b2e0a79f995e..0eab71d4b32c 100644 --- a/java/java-impl/src/com/intellij/spellchecker/JavaSpellcheckingStrategy.java +++ b/java/java-impl/src/com/intellij/spellchecker/JavaSpellcheckingStrategy.java @@ -4,18 +4,14 @@ package com.intellij.spellchecker; import com.intellij.codeInspection.SuppressManager; import com.intellij.psi.*; import com.intellij.psi.javadoc.PsiDocComment; -import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; import com.intellij.spellchecker.tokenizer.SpellcheckingStrategy; import com.intellij.spellchecker.tokenizer.Tokenizer; -import com.intellij.util.containers.ContainerUtil; import com.siyeh.ig.callMatcher.CallHandler; import com.siyeh.ig.callMatcher.CallMapper; import com.siyeh.ig.callMatcher.CallMatcher; -import com.siyeh.ig.psiutils.VariableAccessUtils; import org.jetbrains.annotations.NotNull; -import java.util.List; import java.util.Map; import java.util.function.BiPredicate; import java.util.function.Predicate; @@ -95,14 +91,10 @@ public class JavaSpellcheckingStrategy extends SpellcheckingStrategy { if (element == null) { return false; } - if (element.getParent() instanceof PsiVariable psiVariable) { - List references = VariableAccessUtils.getVariableReferences(psiVariable, PsiTreeUtil.getParentOfType(psiVariable, PsiCodeBlock.class, PsiMethod.class, PsiClass.class)); - return ContainerUtil.or(references, reference -> checkCall(reference)); - } return checkCall(element); } - private static boolean checkCall(PsiElement source) { + private static boolean checkCall(@NotNull PsiElement source) { PsiElement element = PsiUtil.skipParenthesizedExprUp(source); PsiElement parent = element.getParent(); if (!(parent instanceof PsiExpressionList expressionList)) { diff --git a/java/jdkAnnotations/java/text/annotations.xml b/java/jdkAnnotations/java/text/annotations.xml index f7cc23822674..79ee827c5b46 100644 --- a/java/jdkAnnotations/java/text/annotations.xml +++ b/java/jdkAnnotations/java/text/annotations.xml @@ -88,9 +88,11 @@ + + diff --git a/java/jdkAnnotations/java/time/format/annotations.xml b/java/jdkAnnotations/java/time/format/annotations.xml new file mode 100644 index 000000000000..f2ef9fa0b4d2 --- /dev/null +++ b/java/jdkAnnotations/java/time/format/annotations.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/java-i18n/testData/inspections/spellchecker/SkipDateTime.java b/plugins/java-i18n/testData/inspections/spellchecker/SkipDateTime.java index f7f05055e7bc..dbdbc7f330c0 100644 --- a/plugins/java-i18n/testData/inspections/spellchecker/SkipDateTime.java +++ b/plugins/java-i18n/testData/inspections/spellchecker/SkipDateTime.java @@ -5,24 +5,19 @@ import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; class Main { - private static final String s = " CONASTANT"; private static final String s1 = " CONASTANT"; public static void main(String[] args) { System.out.println("1"); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(" CONASTANT"); + SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat(" CONASTANT"); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat(s); - String pattern = " CONASTANT"; - SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat(pattern); + simpleDateFormat.applyPattern( "CONASTANT"); + simpleDateFormat.applyLocalizedPattern("CONASTANT"); - simpleDateFormat.applyPattern( "Errror"); - simpleDateFormat.applyLocalizedPattern("Errror"); + DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("CONASTANT"); - String error1 = "Errror"; - DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(error1); - - String error2 = "Errror"; - new DateTimeFormatterBuilder().appendPattern(error2); + new DateTimeFormatterBuilder().appendPattern("CONASTANT"); } }