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));
}
}