Saved diagnostic parameters into them.
This commit is contained in:
@@ -35,7 +35,7 @@ public class DiagnosticFactory1<E extends PsiElement, A> extends DiagnosticFacto
|
||||
|
||||
@NotNull
|
||||
public ParametrizedDiagnostic<E> on(@NotNull E element, @NotNull A argument) {
|
||||
return new DiagnosticWithPsiElement<E>(element, this, severity, makeMessage(argument));
|
||||
return new DiagnosticWithParameters1<E, A>(element, argument, this, severity, makeMessage(argument));
|
||||
}
|
||||
|
||||
protected DiagnosticFactory1(Severity severity, String message, PositioningStrategy<? super E> positioningStrategy, Renderer<? super A> renderer) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class DiagnosticFactory2<E extends PsiElement, A, B> extends DiagnosticFa
|
||||
|
||||
@NotNull
|
||||
public ParametrizedDiagnostic<E> on(@NotNull E element, @NotNull A a, @NotNull B b) {
|
||||
return new DiagnosticWithPsiElement<E>(element, this, severity, makeMessage(a, b));
|
||||
return new DiagnosticWithParameters2<E, A, B>(element, a, b, this, severity, makeMessage(a, b));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,6 @@ public class DiagnosticFactory3<E extends PsiElement, A, B, C> extends Diagnosti
|
||||
}
|
||||
@NotNull
|
||||
public ParametrizedDiagnostic<E> on(@NotNull E element, @NotNull A a, @NotNull B b, @NotNull C c) {
|
||||
return new DiagnosticWithPsiElement<E>(element, this, severity, makeMessage(a, b, c));
|
||||
return new DiagnosticWithParameters3<E, A, B, C>(element, a, b, c, this, severity, makeMessage(a, b, c));
|
||||
}
|
||||
}
|
||||
|
||||
+56
@@ -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<E extends PsiElement, A> extends AbstractDiagnostic<E> {
|
||||
private A a;
|
||||
|
||||
public DiagnosticWithParameters1(@NotNull E psiElement,
|
||||
@NotNull A a,
|
||||
@NotNull DiagnosticFactory1<E, A> factory,
|
||||
@NotNull Severity severity,
|
||||
@NotNull String message) {
|
||||
super(psiElement, factory, severity, message);
|
||||
this.a = a;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DiagnosticFactory1<E, A> getFactory() {
|
||||
return (DiagnosticFactory1<E, A>)super.getFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<TextRange> getTextRanges() {
|
||||
return getFactory().getTextRanges(this);
|
||||
}
|
||||
|
||||
public A getA() {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
+63
@@ -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<E extends PsiElement, A, B> extends AbstractDiagnostic<E> {
|
||||
private A a;
|
||||
private B b;
|
||||
|
||||
public DiagnosticWithParameters2(@NotNull E psiElement,
|
||||
@NotNull A a,
|
||||
@NotNull B b,
|
||||
@NotNull DiagnosticFactory2<E, A, B> factory,
|
||||
@NotNull Severity severity,
|
||||
@NotNull String message) {
|
||||
super(psiElement, factory, severity, message);
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DiagnosticFactory2<E, A, B> getFactory() {
|
||||
return (DiagnosticFactory2<E, A, B>)super.getFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<TextRange> getTextRanges() {
|
||||
return getFactory().getTextRanges(this);
|
||||
}
|
||||
|
||||
public A getA() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public B getB() {
|
||||
return b;
|
||||
}
|
||||
}
|
||||
+70
@@ -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<E extends PsiElement, A, B, C> extends AbstractDiagnostic<E> {
|
||||
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<E, A, B, C> 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<E, A, B, C> getFactory() {
|
||||
return (DiagnosticFactory3<E, A, B, C>)super.getFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<TextRange> getTextRanges() {
|
||||
return getFactory().getTextRanges(this);
|
||||
}
|
||||
|
||||
public A getA() {
|
||||
return a;
|
||||
}
|
||||
|
||||
public B getB() {
|
||||
return b;
|
||||
}
|
||||
|
||||
public C getC() {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ public class DiagnosticWithPsiElement<E extends PsiElement> extends AbstractDiag
|
||||
return (DiagnosticFactoryWithPsiElement<E>)super.getFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<TextRange> getTextRanges() {
|
||||
return getFactory().getTextRanges(this);
|
||||
|
||||
Reference in New Issue
Block a user