Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.1
-
None
Description
TypeUtilsTest originally contained the following under #testIsAssignable():
Assert.assertTrue("WRONG!", TypeUtils.isAssignable(dingType, disType));
For background:
public interface This<K, V> { } public class Other<T> implements This<String, T> { } public class Thing<Q> extends Other<B> { }
<B> refers to a type parameter on the TypeUtilsTest class itself.
disType and dingType refer to the generic types of the following fields, respectively:
public This<String, String> dis; public Thing ding;
Thus the assertion in question declares that type Thing is assignable to This<String, String>. If we start at This we can see that the implementing class Other maps its T type parameter to the V type parameter of This. From this point we can proceed down to Thing and see that it maps the B type parameter of the enclosing TypeUtilsTest class to the T type parameter of Other. Thus it is fairly obvious that only a TypeUtilsTest<String>.Thing is assignable to This<String, String>. From this we can determine that the intent of the message in the original test assertion must indeed have been to flag an incorrect assertion. This is the associated bug report.
Attachments
Issue Links
- relates to
-
LANG-775 TypeUtils.getTypeArguments() misses type arguments for partially-assigned classes
- Closed