diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory1.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory1.java index c6e1d9d3f91..139337eab2a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory1.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory1.java @@ -35,7 +35,7 @@ public class DiagnosticFactory1 extends DiagnosticFacto @NotNull public ParametrizedDiagnostic on(@NotNull E element, @NotNull A argument) { - return new DiagnosticWithPsiElement(element, this, severity, makeMessage(argument)); + return new DiagnosticWithParameters1(element, argument, this, severity, makeMessage(argument)); } protected DiagnosticFactory1(Severity severity, String message, PositioningStrategy positioningStrategy, Renderer renderer) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory2.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory2.java index 8eb63ff8c04..767326616f0 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory2.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory2.java @@ -40,7 +40,7 @@ public class DiagnosticFactory2 extends DiagnosticFa @NotNull public ParametrizedDiagnostic on(@NotNull E element, @NotNull A a, @NotNull B b) { - return new DiagnosticWithPsiElement(element, this, severity, makeMessage(a, b)); + return new DiagnosticWithParameters2(element, a, b, this, severity, makeMessage(a, b)); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory3.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory3.java index caa5b8518e1..1ad9fda7b3e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory3.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticFactory3.java @@ -67,6 +67,6 @@ public class DiagnosticFactory3 extends Diagnosti } @NotNull public ParametrizedDiagnostic on(@NotNull E element, @NotNull A a, @NotNull B b, @NotNull C c) { - return new DiagnosticWithPsiElement(element, this, severity, makeMessage(a, b, c)); + return new DiagnosticWithParameters3(element, a, b, c, this, severity, makeMessage(a, b, c)); } } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithParameters1.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithParameters1.java new file mode 100644 index 00000000000..ad757faf103 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithParameters1.java @@ -0,0 +1,56 @@ +/* + * 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 java.util.List; + +/** + * @author Evgeny Gerashchenko + * @since 4/11/12 + */ +public class DiagnosticWithParameters1 extends AbstractDiagnostic { + private A a; + + public DiagnosticWithParameters1(@NotNull E psiElement, + @NotNull A a, + @NotNull DiagnosticFactory1 factory, + @NotNull Severity severity, + @NotNull String message) { + super(psiElement, factory, severity, message); + this.a = a; + } + + @NotNull + @Override + public DiagnosticFactory1 getFactory() { + return (DiagnosticFactory1)super.getFactory(); + } + + @Override + @NotNull + public List getTextRanges() { + return getFactory().getTextRanges(this); + } + + public A getA() { + return a; + } +} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithParameters2.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithParameters2.java new file mode 100644 index 00000000000..51690b5e7d8 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithParameters2.java @@ -0,0 +1,63 @@ +/* + * 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 java.util.List; + +/** + * @author Evgeny Gerashchenko + * @since 4/11/12 + */ +public class DiagnosticWithParameters2 extends AbstractDiagnostic { + private A a; + private B b; + + public DiagnosticWithParameters2(@NotNull E psiElement, + @NotNull A a, + @NotNull B b, + @NotNull DiagnosticFactory2 factory, + @NotNull Severity severity, + @NotNull String message) { + super(psiElement, factory, severity, message); + this.a = a; + this.b = b; + } + + @NotNull + @Override + public DiagnosticFactory2 getFactory() { + return (DiagnosticFactory2)super.getFactory(); + } + + @Override + @NotNull + public List getTextRanges() { + return getFactory().getTextRanges(this); + } + + public A getA() { + return a; + } + + public B getB() { + return b; + } +} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithParameters3.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithParameters3.java new file mode 100644 index 00000000000..a57d8526e86 --- /dev/null +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithParameters3.java @@ -0,0 +1,70 @@ +/* + * 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 java.util.List; + +/** + * @author Evgeny Gerashchenko + * @since 4/11/12 + */ +public class DiagnosticWithParameters3 extends AbstractDiagnostic { + private A a; + private B b; + private C c; + + public DiagnosticWithParameters3(@NotNull E psiElement, + @NotNull A a, + @NotNull B b, + @NotNull C c, + @NotNull DiagnosticFactory3 factory, + @NotNull Severity severity, + @NotNull String message) { + super(psiElement, factory, severity, message); + this.a = a; + this.b = b; + this.c = c; + } + + @NotNull + @Override + public DiagnosticFactory3 getFactory() { + return (DiagnosticFactory3)super.getFactory(); + } + + @Override + @NotNull + public List getTextRanges() { + return getFactory().getTextRanges(this); + } + + public A getA() { + return a; + } + + public B getB() { + return b; + } + + public C getC() { + return c; + } +} diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithPsiElement.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithPsiElement.java index a73ce08470a..5d7fe6c0a6e 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithPsiElement.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/DiagnosticWithPsiElement.java @@ -36,6 +36,7 @@ public class DiagnosticWithPsiElement extends AbstractDiag return (DiagnosticFactoryWithPsiElement)super.getFactory(); } + @Override @NotNull public List getTextRanges() { return getFactory().getTextRanges(this);