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 4ceecb4bef3..332b6075124 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java @@ -44,14 +44,14 @@ public interface Errors { DiagnosticFactory1 EXCEPTION_WHILE_ANALYZING = DiagnosticFactory1.create(ERROR); - UnresolvedReferenceDiagnosticFactory UNRESOLVED_REFERENCE = UnresolvedReferenceDiagnosticFactory.create("Unresolved reference"); + UnresolvedReferenceDiagnosticFactory UNRESOLVED_REFERENCE = UnresolvedReferenceDiagnosticFactory.create(); //Elements with "INVISIBLE_REFERENCE" error are marked as unresolved, unlike elements with "INVISIBLE_MEMBER" error DiagnosticFactory2 INVISIBLE_REFERENCE = DiagnosticFactory2.create(ERROR); DiagnosticFactory2 INVISIBLE_MEMBER = DiagnosticFactory2.create(ERROR); - RedeclarationDiagnosticFactory REDECLARATION = RedeclarationDiagnosticFactory.REDECLARATION; - RedeclarationDiagnosticFactory NAME_SHADOWING = RedeclarationDiagnosticFactory.NAME_SHADOWING; + RedeclarationDiagnosticFactory REDECLARATION = new RedeclarationDiagnosticFactory(ERROR); + RedeclarationDiagnosticFactory NAME_SHADOWING = new RedeclarationDiagnosticFactory(WARNING); DiagnosticFactory2 TYPE_MISMATCH = DiagnosticFactory2.create(ERROR ); @@ -107,7 +107,7 @@ public interface Errors { .create(ERROR); SimpleDiagnosticFactory ARGUMENT_PASSED_TWICE = SimpleDiagnosticFactory.create(ERROR); - UnresolvedReferenceDiagnosticFactory NAMED_PARAMETER_NOT_FOUND = UnresolvedReferenceDiagnosticFactory.create("Cannot find a parameter with this name"); + UnresolvedReferenceDiagnosticFactory NAMED_PARAMETER_NOT_FOUND = UnresolvedReferenceDiagnosticFactory.create(); SimpleDiagnosticFactory VARARG_OUTSIDE_PARENTHESES = SimpleDiagnosticFactory .create(ERROR); SimpleDiagnosticFactory diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/RedeclarationDiagnosticFactory.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/RedeclarationDiagnosticFactory.java index 053238f2839..59d138f52c4 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/RedeclarationDiagnosticFactory.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/RedeclarationDiagnosticFactory.java @@ -23,36 +23,16 @@ import org.jetbrains.annotations.NotNull; * @author abreslav */ public class RedeclarationDiagnosticFactory extends AbstractDiagnosticFactory { - - private final String name; final Severity severity; - private final String messagePrefix; - public static final RedeclarationDiagnosticFactory REDECLARATION = new RedeclarationDiagnosticFactory( - "REDECLARATION", Severity.ERROR, "Redeclaration: "); - public static final RedeclarationDiagnosticFactory NAME_SHADOWING = new RedeclarationDiagnosticFactory( - "NAME_SHADOWING", Severity.WARNING, "Name shadowed: "); - - public RedeclarationDiagnosticFactory(String name, Severity severity, String messagePrefix) { - this.name = name; + public RedeclarationDiagnosticFactory(Severity severity) { this.severity = severity; - this.messagePrefix = messagePrefix; } public RedeclarationDiagnostic on(@NotNull PsiElement duplicatingElement, @NotNull String name) { return new RedeclarationDiagnostic.SimpleRedeclarationDiagnostic(duplicatingElement, name, this); } - @NotNull - @Override - public String getName() { - return name; - } - - public String makeMessage(String identifier) { - return messagePrefix + identifier; - } - @Override public String toString() { return getName(); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/UnresolvedReferenceDiagnosticFactory.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/UnresolvedReferenceDiagnosticFactory.java index b4fd2e6e889..4aee43e3422 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/UnresolvedReferenceDiagnosticFactory.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/UnresolvedReferenceDiagnosticFactory.java @@ -23,21 +23,14 @@ import org.jetbrains.jet.lang.psi.JetReferenceExpression; * @author abreslav */ public class UnresolvedReferenceDiagnosticFactory extends AbstractDiagnosticFactory { - private final String message; - - private UnresolvedReferenceDiagnosticFactory(String message) { - this.message = message; - } - - String getMessage() { - return message; + private UnresolvedReferenceDiagnosticFactory() { } public UnresolvedReferenceDiagnostic on(@NotNull JetReferenceExpression reference) { return new UnresolvedReferenceDiagnostic(reference, this); } - public static UnresolvedReferenceDiagnosticFactory create(String message) { - return new UnresolvedReferenceDiagnosticFactory(message); + public static UnresolvedReferenceDiagnosticFactory create() { + return new UnresolvedReferenceDiagnosticFactory(); } }