mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
reifiable types: ensure that generic types with only all type params as unbound wildcards are treated as reifiable (IDEA-139577)
This commit is contained in:
+6
-3
@@ -48,10 +48,13 @@ public class JavaGenericsUtil {
|
||||
}
|
||||
PsiType[] parameters = classType.getParameters();
|
||||
|
||||
for (PsiType parameter : parameters) {
|
||||
if (parameter instanceof PsiWildcardType && ((PsiWildcardType)parameter).getBound() == null) {
|
||||
return true;
|
||||
if (parameters.length > 0) {
|
||||
for (PsiType parameter : parameters) {
|
||||
if (!(parameter instanceof PsiWildcardType && ((PsiWildcardType)parameter).getBound() == null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
final PsiClass resolved = ((PsiClassType)PsiUtil.convertAnonymousToBaseType(classType)).resolve();
|
||||
if (resolved instanceof PsiTypeParameter) {
|
||||
|
||||
+3
-1
@@ -1,7 +1,7 @@
|
||||
import java.util.List;
|
||||
|
||||
<error descr="'@SafeVarargs' not applicable to type">@SafeVarargs</error>
|
||||
public class SafeVarargsTests {
|
||||
class SafeVarargsTests {
|
||||
//fixed arity
|
||||
<error descr="@SafeVarargs is not allowed on methods with fixed arity">@SafeVarargs</error>
|
||||
public void testNonVarargs1(){}
|
||||
@@ -43,6 +43,8 @@ public class SafeVarargsTests {
|
||||
public static <T> void foo1(List<T>... <warning descr="Parameter 't' is never used">t</warning>){}
|
||||
@SafeVarargs
|
||||
public static <T> void foo2(List<? extends T>... <warning descr="Parameter 't' is never used">t</warning>){}
|
||||
@SafeVarargs
|
||||
public static <T> void foo2(java.util.Map<?, T>... <warning descr="Parameter 't' is never used">t</warning>){}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user