mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
simlify ? super ? wildcard (IDEA-63765)
This commit is contained in:
@@ -40,7 +40,8 @@ public class TypesDistinctProver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (type2 instanceof PsiCapturedWildcardType) {
|
if (type2 instanceof PsiCapturedWildcardType) {
|
||||||
return provablyDistinct((PsiWildcardType)type1, ((PsiCapturedWildcardType)type2).getWildcard());
|
return ((PsiWildcardType)type1).isExtends() ||
|
||||||
|
provablyDistinct((PsiWildcardType)type1, ((PsiCapturedWildcardType)type2).getWildcard());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type2 instanceof PsiClassType) {
|
if (type2 instanceof PsiClassType) {
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ public class PsiSubstitutorImpl implements PsiSubstitutor {
|
|||||||
if (wildcardType.isExtends() != wildcard.isExtends()) {
|
if (wildcardType.isExtends() != wildcard.isExtends()) {
|
||||||
return wildcard.isBounded() ? PsiWildcardType.createUnbounded(wildcardType.getManager()) : newBound;
|
return wildcard.isBounded() ? PsiWildcardType.createUnbounded(wildcardType.getManager()) : newBound;
|
||||||
}
|
}
|
||||||
|
if (!wildcard.isBounded()) return PsiWildcardType.createUnbounded(wildcardType.getManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
return PsiWildcardType.changeBound(wildcardType, newBound);
|
return PsiWildcardType.changeBound(wildcardType, newBound);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import java.lang.reflect.*;
|
|||||||
|
|
||||||
class Example {
|
class Example {
|
||||||
private void demo() {
|
private void demo() {
|
||||||
<error descr="Cannot resolve symbol 'TypeVariable'">TypeVariable</error><Class<? extends Example>>[] typeParameters = getClass().getTypeParameters();
|
<error descr="Incompatible types. Found: 'java.lang.reflect.TypeVariable<java.lang.Class<capture<? extends Example>>>[]', required: 'java.lang.reflect.TypeVariable<java.lang.Class<? extends Example>>[]'">TypeVariable<Class<? extends Example>>[] typeParameters = getClass().getTypeParameters();</error>
|
||||||
|
Object typeParameters1 = <error descr="Inconvertible types; cannot cast 'java.lang.reflect.TypeVariable<java.lang.Class<capture<? extends Example>>>[]' to 'java.lang.reflect.TypeVariable<java.lang.Class<? extends Example>>[]'">(TypeVariable<Class<? extends Example>>[]) getClass().getTypeParameters()</error>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class AllPredicate<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void foo(SortedMap<?, ?> sourceSortedMap) {
|
public static void foo(SortedMap<?, ?> sourceSortedMap) {
|
||||||
new TreeMap<Object, Object>(<warning descr="Unchecked cast: 'java.util.Comparator<capture<? super capture<?>>>' to 'java.util.Comparator<? super java.lang.Object>'">(Comparator<? super Object>) sourceSortedMap.comparator()</warning>);
|
new TreeMap<Object, Object>(<warning descr="Unchecked cast: 'java.util.Comparator<capture<?>>' to 'java.util.Comparator<? super java.lang.Object>'">(Comparator<? super Object>) sourceSortedMap.comparator()</warning>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user