You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2016/07/31 18:04:20 UTC
[jira] [Resolved] (LANG-1190) TypeUtils.isAssignable throws
NullPointerException when fromType has type variables and toType generic
superclass specifies type variable
[ https://issues.apache.org/jira/browse/LANG-1190?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Schumacher resolved LANG-1190.
-------------------------------------
Resolution: Fixed
Assignee: Pascal Schumacher
Fix Version/s: 3.5
Thanks for reporting.
> TypeUtils.isAssignable throws NullPointerException when fromType has type variables and toType generic superclass specifies type variable
> -----------------------------------------------------------------------------------------------------------------------------------------
>
> Key: LANG-1190
> URL: https://issues.apache.org/jira/browse/LANG-1190
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.reflect.*
> Affects Versions: 3.4
> Reporter: Yuhau Lin
> Assignee: Pascal Schumacher
> Fix For: 3.5
>
>
> {code:java}
> import static org.apache.commons.lang3.reflect.TypeUtils.*;
> import java.lang.reflect.InvocationTargetException;
> import java.lang.reflect.Type;
> import java.util.ArrayList;
> public class Demonstration {
> public static <U> Iterable<U> someMethod() { return null; }
>
> public static class WorkingClass extends ArrayList { }
> public static class FailingClass extends ArrayList<Object> { }
>
>
> public static void main(String[] args) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
> Type fromType = Demonstration.class.getDeclaredMethod("someMethod").getGenericReturnType();
> Type workingToType = wildcardType().withLowerBounds(WorkingClass.class).build();
> Type failingToType = wildcardType().withLowerBounds(FailingClass.class).build();
>
> System.out.println(fromType);
> System.out.println(workingToType);
> System.out.println(failingToType);
>
> System.out.println(isAssignable(fromType, workingToType));
> System.out.println(isAssignable(fromType, failingToType));
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)