Removed RedeclarationDiagnostic class, since it's not very useful.
This commit is contained in:
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2012 JetBrains s.r.o.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.jetbrains.jet.lang.diagnostics;
|
|
||||||
|
|
||||||
import com.intellij.openapi.util.TextRange;
|
|
||||||
import com.intellij.psi.PsiElement;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.jet.lang.psi.JetFile;
|
|
||||||
import org.jetbrains.jet.lang.psi.JetNamedDeclaration;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author abreslav
|
|
||||||
*/
|
|
||||||
public class RedeclarationDiagnostic extends DiagnosticWithParameters1<PsiElement, String> {
|
|
||||||
public RedeclarationDiagnostic(@NotNull PsiElement psiElement, @NotNull String name,
|
|
||||||
@NotNull RedeclarationDiagnosticFactory factory, @NotNull Severity severity) {
|
|
||||||
super(psiElement, name, factory, severity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-4
@@ -52,8 +52,4 @@ public class RedeclarationDiagnosticFactory extends DiagnosticFactory1<PsiElemen
|
|||||||
public RedeclarationDiagnosticFactory(Severity severity) {
|
public RedeclarationDiagnosticFactory(Severity severity) {
|
||||||
super(severity, POSITION_REDECLARATION);
|
super(severity, POSITION_REDECLARATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RedeclarationDiagnostic on(@NotNull PsiElement duplicatingElement, @NotNull String name) {
|
|
||||||
return new RedeclarationDiagnostic(duplicatingElement, name, this, severity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,9 +182,8 @@ public class JetPsiChecker implements Annotator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diagnostic instanceof RedeclarationDiagnostic) {
|
if (diagnostic.getFactory() instanceof RedeclarationDiagnosticFactory) {
|
||||||
RedeclarationDiagnostic redeclarationDiagnostic = (RedeclarationDiagnostic)diagnostic;
|
registerQuickFix(markRedeclaration(redeclarations, diagnostic, holder), diagnostic);
|
||||||
registerQuickFix(markRedeclaration(redeclarations, redeclarationDiagnostic, holder), diagnostic);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,11 +248,11 @@ public class JetPsiChecker implements Annotator {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private static Annotation markRedeclaration(@NotNull Set<PsiElement> redeclarations,
|
private static Annotation markRedeclaration(@NotNull Set<PsiElement> redeclarations,
|
||||||
@NotNull RedeclarationDiagnostic diagnostic,
|
@NotNull Diagnostic redeclarationDiagnostic,
|
||||||
@NotNull AnnotationHolder holder) {
|
@NotNull AnnotationHolder holder) {
|
||||||
if (!redeclarations.add(diagnostic.getPsiElement())) return null;
|
if (!redeclarations.add(redeclarationDiagnostic.getPsiElement())) return null;
|
||||||
List<TextRange> textRanges = diagnostic.getTextRanges();
|
List<TextRange> textRanges = redeclarationDiagnostic.getTextRanges();
|
||||||
if (textRanges.isEmpty()) return null;
|
if (textRanges.isEmpty()) return null;
|
||||||
return holder.createErrorAnnotation(textRanges.get(0), getMessage(diagnostic));
|
return holder.createErrorAnnotation(textRanges.get(0), getMessage(redeclarationDiagnostic));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user