#LAN-1114 fixes bug in TypeUtils.equals(WildcardType, Type) where it was incorrectly returning true when the second argument was not a Wildcard type.
This commit is contained in:
parent
63d8a025e6
commit
e2c0ea4374
|
@ -1626,7 +1626,7 @@ public class TypeUtils {
|
|||
return equals(getImplicitLowerBounds(w), getImplicitLowerBounds(other))
|
||||
&& equals(getImplicitUpperBounds(w), getImplicitUpperBounds(other));
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -97,6 +97,8 @@ public class TypeUtilsTest<B> {
|
|||
|
||||
public static Comparable<Long> longComparable;
|
||||
|
||||
public static Comparable<?> wildcardComparable;
|
||||
|
||||
public static URI uri;
|
||||
|
||||
public void dummyMethod(final List list0, final List<Object> list1, final List<?> list2,
|
||||
|
@ -722,6 +724,15 @@ public class TypeUtilsTest<B> {
|
|||
Assert.assertEquals(String.format("? super %s", iterableT0.getName()), lowerTypeVariable.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLang1114() throws Exception {
|
||||
final Type nonWildcardType = getClass().getDeclaredField("wildcardComparable").getGenericType();
|
||||
final Type wildcardType = ((ParameterizedType)nonWildcardType).getActualTypeArguments()[0];
|
||||
|
||||
Assert.assertFalse(TypeUtils.equals(wildcardType, nonWildcardType));
|
||||
Assert.assertFalse(TypeUtils.equals(nonWildcardType, wildcardType));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGenericArrayType() throws Exception {
|
||||
final Type expected = getClass().getField("intWildcardComparable").getGenericType();
|
||||
|
|
Loading…
Reference in New Issue