Merge branch 'bug/LANG-1114-TypeUtils.Wildcard.equals.bug'
LANG-1114: TypeUtils.ParameterizedType#equals doesn't work with wildcard types. This closes #73 from github. Thanks to Andy Coates.
This commit is contained in:
commit
640953167a
|
@ -22,6 +22,7 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<release version="3.5" date="tba" description="tba">
|
<release version="3.5" date="tba" description="tba">
|
||||||
|
<action issue="LANG-1114" type="fix" dev="britter" due-to="Andy Coates">TypeUtils.ParameterizedType#equals doesn't work with wildcard types</action>
|
||||||
<action issue="LANG-1119" type="add" dev="britter" due-to="Loic Guibert">Add rotate(string, int) method to StringUtils</action>
|
<action issue="LANG-1119" type="add" dev="britter" due-to="Loic Guibert">Add rotate(string, int) method to StringUtils</action>
|
||||||
<action issue="LANG-1118" type="fix" dev="britter" due-to="Loic Guibert">StringUtils.repeat('z', -1) throws NegativeArraySizeException</action>
|
<action issue="LANG-1118" type="fix" dev="britter" due-to="Loic Guibert">StringUtils.repeat('z', -1) throws NegativeArraySizeException</action>
|
||||||
<action issue="LANG-1099" type="add" dev="britter" due-to="Adrian Ber">Add swap and shift operations for arrays to ArrayUtils</action>
|
<action issue="LANG-1099" type="add" dev="britter" due-to="Adrian Ber">Add swap and shift operations for arrays to ArrayUtils</action>
|
||||||
|
|
|
@ -1626,7 +1626,7 @@ public class TypeUtils {
|
||||||
return equals(getImplicitLowerBounds(w), getImplicitLowerBounds(other))
|
return equals(getImplicitLowerBounds(w), getImplicitLowerBounds(other))
|
||||||
&& equals(getImplicitUpperBounds(w), getImplicitUpperBounds(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<Long> longComparable;
|
||||||
|
|
||||||
|
public static Comparable<?> wildcardComparable;
|
||||||
|
|
||||||
public static URI uri;
|
public static URI uri;
|
||||||
|
|
||||||
public void dummyMethod(final List list0, final List<Object> list1, final List<?> list2,
|
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());
|
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
|
@Test
|
||||||
public void testGenericArrayType() throws Exception {
|
public void testGenericArrayType() throws Exception {
|
||||||
final Type expected = getClass().getField("intWildcardComparable").getGenericType();
|
final Type expected = getClass().getField("intWildcardComparable").getGenericType();
|
||||||
|
|
Loading…
Reference in New Issue