Refactoring: Remove misleading that code processes both redeclaration and shadowing

NAME_SHADOWING is a warning so it has never been handled there
This commit is contained in:
Nikolay Krasko
2013-10-23 16:03:32 +04:00
parent e96c76b0d8
commit d6821ebfb6
2 changed files with 3 additions and 5 deletions
@@ -565,8 +565,6 @@ public interface Errors {
UNRESOLVED_REFERENCE, NAMED_PARAMETER_NOT_FOUND, UNRESOLVED_REFERENCE_WRONG_RECEIVER); UNRESOLVED_REFERENCE, NAMED_PARAMETER_NOT_FOUND, UNRESOLVED_REFERENCE_WRONG_RECEIVER);
ImmutableSet<? extends DiagnosticFactory> UNUSED_ELEMENT_DIAGNOSTICS = ImmutableSet.of( ImmutableSet<? extends DiagnosticFactory> UNUSED_ELEMENT_DIAGNOSTICS = ImmutableSet.of(
UNUSED_VARIABLE, UNUSED_PARAMETER, ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE); UNUSED_VARIABLE, UNUSED_PARAMETER, ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE);
ImmutableSet<? extends DiagnosticFactory> REDECLARATION_DIAGNOSTICS = ImmutableSet.of(
REDECLARATION, NAME_SHADOWING);
ImmutableSet<? extends DiagnosticFactory> TYPE_INFERENCE_ERRORS = ImmutableSet.of( ImmutableSet<? extends DiagnosticFactory> TYPE_INFERENCE_ERRORS = ImmutableSet.of(
TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER, TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS, TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH, 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); TYPE_INFERENCE_UPPER_BOUND_VIOLATED, TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH);
@@ -133,8 +133,8 @@ public class JetPsiChecker implements Annotator, HighlightRangeExtension {
} }
private static class ElementAnnotator { private static class ElementAnnotator {
@NotNull private final PsiElement element; private final PsiElement element;
@NotNull private final AnnotationHolder holder; private final AnnotationHolder holder;
private boolean isMarkedWithRedeclaration; private boolean isMarkedWithRedeclaration;
@@ -179,7 +179,7 @@ public class JetPsiChecker implements Annotator, HighlightRangeExtension {
return; return;
} }
if (Errors.REDECLARATION_DIAGNOSTICS.contains(diagnostic.getFactory())) { if (diagnostic.getFactory() == Errors.REDECLARATION) {
if (!isMarkedWithRedeclaration) { if (!isMarkedWithRedeclaration) {
isMarkedWithRedeclaration = true; isMarkedWithRedeclaration = true;
Annotation annotation = holder.createErrorAnnotation(diagnostic.getTextRanges().get(0), ""); Annotation annotation = holder.createErrorAnnotation(diagnostic.getTextRanges().get(0), "");