From d6821ebfb61573a50d9a66c2938052c8f96e5453 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Wed, 23 Oct 2013 16:03:32 +0400 Subject: [PATCH] Refactoring: Remove misleading that code processes both redeclaration and shadowing NAME_SHADOWING is a warning so it has never been handled there --- .../src/org/jetbrains/jet/lang/diagnostics/Errors.java | 2 -- .../org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java index 20a4e94f883..5f3a601b45d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java @@ -565,8 +565,6 @@ public interface Errors { UNRESOLVED_REFERENCE, NAMED_PARAMETER_NOT_FOUND, UNRESOLVED_REFERENCE_WRONG_RECEIVER); ImmutableSet UNUSED_ELEMENT_DIAGNOSTICS = ImmutableSet.of( UNUSED_VARIABLE, UNUSED_PARAMETER, ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE); - ImmutableSet REDECLARATION_DIAGNOSTICS = ImmutableSet.of( - REDECLARATION, NAME_SHADOWING); ImmutableSet TYPE_INFERENCE_ERRORS = ImmutableSet.of( TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER, TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS, TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH, TYPE_INFERENCE_UPPER_BOUND_VIOLATED, TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH); diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java index 665edd9ffc7..5f8b9e212a7 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java @@ -133,8 +133,8 @@ public class JetPsiChecker implements Annotator, HighlightRangeExtension { } private static class ElementAnnotator { - @NotNull private final PsiElement element; - @NotNull private final AnnotationHolder holder; + private final PsiElement element; + private final AnnotationHolder holder; private boolean isMarkedWithRedeclaration; @@ -179,7 +179,7 @@ public class JetPsiChecker implements Annotator, HighlightRangeExtension { return; } - if (Errors.REDECLARATION_DIAGNOSTICS.contains(diagnostic.getFactory())) { + if (diagnostic.getFactory() == Errors.REDECLARATION) { if (!isMarkedWithRedeclaration) { isMarkedWithRedeclaration = true; Annotation annotation = holder.createErrorAnnotation(diagnostic.getTextRanges().get(0), "");