mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
check reference type as type argument for constructor params (IDEA-57668)
This commit is contained in:
+1
-1
@@ -634,7 +634,7 @@ public class GenericsHighlightUtil {
|
||||
type instanceof PsiWildcardType && ((PsiWildcardType)type).getBound() instanceof PsiPrimitiveType) {
|
||||
final PsiElement element = new PsiMatcherImpl(typeElement)
|
||||
.parent(PsiMatchers.hasClass(PsiReferenceParameterList.class))
|
||||
.parent(PsiMatchers.hasClass(PsiJavaCodeReferenceElement.class))
|
||||
.parent(PsiMatchers.hasClass(PsiJavaCodeReferenceElement.class, PsiNewExpression.class))
|
||||
.getElement();
|
||||
if (element == null) return null;
|
||||
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
class A {
|
||||
<T> A() {}
|
||||
|
||||
{
|
||||
new <<error descr="Type argument cannot be of primitive type">int</error>>A();
|
||||
}
|
||||
}
|
||||
|
||||
class B<T> {
|
||||
{
|
||||
new B<<error descr="Type argument cannot be of primitive type">int</error>>();
|
||||
B.<<error descr="Type argument cannot be of primitive type">int</error>>m();
|
||||
}
|
||||
|
||||
<S> void m(){}
|
||||
|
||||
}
|
||||
@@ -151,6 +151,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testIDEA89801() throws Exception { doTest(false); }
|
||||
public void testIDEA67681() throws Exception { doTest(false); }
|
||||
public void testIDEA67599() throws Exception { doTest(false); }
|
||||
public void testIDEA57668() throws Exception { doTest(false); }
|
||||
public void testInconvertibleTypes() throws Exception { doTest(false); }
|
||||
public void testIncompatibleReturnType() throws Exception { doTest(false); }
|
||||
public void testContinueInferenceAfterFirstRawResult() throws Exception { doTest(false); }
|
||||
|
||||
@@ -71,7 +71,7 @@ public class PsiMatchers {
|
||||
};
|
||||
}
|
||||
|
||||
public static PsiMatcherExpression hasClass(final Class[] classes) {
|
||||
public static PsiMatcherExpression hasClass(final Class... classes) {
|
||||
return new PsiMatcherExpression() {
|
||||
@Override
|
||||
public Boolean match(PsiElement element) {
|
||||
|
||||
Reference in New Issue
Block a user