[groovy] don't treat [] as constructor invocation if assigned to j.l.Class

This commit is contained in:
Daniil Ovchinnikov
2017-07-07 12:55:21 +03:00
parent 9cbc654745
commit 6951947fbb
2 changed files with 3 additions and 2 deletions
@@ -142,6 +142,7 @@ public class LiteralConstructorReference extends PsiReferenceBase.Poly<GrListOrM
private static PsiClassType filterOutTrashTypes(PsiType type) {
if (!(type instanceof PsiClassType)) return null;
if (type.equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) return null;
if (TypesUtil.resolvesTo(type, CommonClassNames.JAVA_LANG_CLASS)) return null;
if (TypesUtil.resolvesTo(type, CommonClassNames.JAVA_UTIL_MAP)) return null;
if (TypesUtil.resolvesTo(type, CommonClassNames.JAVA_UTIL_HASH_MAP)) return null;
if (TypesUtil.resolvesTo(type, CommonClassNames.JAVA_UTIL_LIST)) return null;
@@ -56,7 +56,7 @@ class FooClass {
<warning descr="Cannot assign 'Closure<Integer>' to 'Class'">c</warning> = { int a, int b -> a + b }
<warning descr="Cannot assign 'Object' to 'Class'">c</warning> = o
<warning descr="Cannot assign 'Matcher' to 'Class'">c</warning> = "aaa" =~ /aaa/
c = <error descr="Constructor 'Class' in 'java.lang.Class' cannot be applied to '()'">[]</error>
<warning descr="Cannot assign 'List' to 'Class'">c</warning> = []
c = "java.util.List"
c = List
}
@@ -82,7 +82,7 @@ class FooClass {
Class <warning descr="Cannot assign 'Closure<Integer>' to 'Class'">c17</warning> = { int a, int b -> a + b }
Class <warning descr="Cannot assign 'Object' to 'Class'">c18</warning> = o
Class <warning descr="Cannot assign 'Matcher' to 'Class'">c19</warning> = "aaa" =~ /aaa/
Class c20 = <error descr="Constructor 'Class' in 'java.lang.Class' cannot be applied to '()'">[]</error>
Class <warning descr="Cannot assign 'List' to 'Class'">c20</warning> = []
Class c21 = "java.util.List"
Class c22 = List
}