@@ -207,6 +207,15 @@ public class Tester implements This<String, B> {
207207 // empty
208208 }
209209
210+ private interface TestIF <T > {
211+ }
212+
213+ private static class TestImpl <T > implements TestIF <T > {
214+ }
215+
216+ private static class TestImpl2 <R > implements TestIF <Number > {
217+ }
218+
210219 public class That <K , V > implements This <K , V > {
211220 // empty
212221 }
@@ -664,6 +673,24 @@ void testIsArrayTypeClasses() {
664673 assertFalse (TypeUtils .isArrayType (String .class ));
665674 }
666675
676+ @ Test
677+ void testIsAssignable_ClassWithParameterizedType () {
678+ final ParameterizedType topre1 = TypeUtils .parameterize (TestIF .class , TypeUtils .wildcardType ().build ());
679+ final Type to1 = TypeUtils .parameterize (Class .class , TypeUtils .wildcardType ().withUpperBounds (topre1 ).build ());
680+ final Type from1 = TypeUtils .parameterize (Class .class , TestIF .class );
681+ assertFalse (TypeUtils .isAssignable (from1 , to1 ), "Class<TestIF> should not be assignable to Class<? extends TestIF<?>>" );
682+
683+ final ParameterizedType topre2 = TypeUtils .parameterize (TestIF .class , TypeUtils .wildcardType ().build ());
684+ final Type to2 = TypeUtils .parameterize (Class .class , TypeUtils .wildcardType ().withUpperBounds (topre2 ).build ());
685+ final Type from2 = TypeUtils .parameterize (Class .class , TestImpl .class );
686+ assertFalse (TypeUtils .isAssignable (from2 , to2 ), "Class<TestImpl> should not be assignable to Class<? extends TestIF<?>>" );
687+
688+ final ParameterizedType topre3 = TypeUtils .parameterize (TestIF .class , Number .class );
689+ final Type to3 = TypeUtils .parameterize (Class .class , TypeUtils .wildcardType ().withUpperBounds (topre3 ).build ());
690+ final Type from3 = TypeUtils .parameterize (Class .class , TestImpl2 .class );
691+ assertFalse (TypeUtils .isAssignable (from3 , to3 ), "Class<TestImpl2> should not be assignable to Class<? extends TestIF<Number>>" );
692+ }
693+
667694 @ Test
668695 void testIsAssignableClasses () {
669696 assertTrue (TypeUtils .isAssignable (char .class , double .class ));
@@ -773,33 +800,6 @@ void testIsAssignableGenericArrayTypeToWildcardType() {
773800 () -> String .format ("TypeUtils.isAssignable(%s, %s)" , testType , paramType ));
774801 }
775802
776- @ Test
777- void testIsAssignable_ClassWithParameterizedType () {
778- final ParameterizedType topre1 = TypeUtils .parameterize (TestIF .class , TypeUtils .wildcardType ().build ());
779- final Type to1 = TypeUtils .parameterize (Class .class , TypeUtils .wildcardType ().withUpperBounds (topre1 ).build ());
780- final Type from1 = TypeUtils .parameterize (Class .class , TestIF .class );
781- assertFalse (TypeUtils .isAssignable (from1 , to1 ), "Class<TestIF> should not be assignable to Class<? extends TestIF<?>>" );
782-
783- final ParameterizedType topre2 = TypeUtils .parameterize (TestIF .class , TypeUtils .wildcardType ().build ());
784- final Type to2 = TypeUtils .parameterize (Class .class , TypeUtils .wildcardType ().withUpperBounds (topre2 ).build ());
785- final Type from2 = TypeUtils .parameterize (Class .class , TestImpl .class );
786- assertFalse (TypeUtils .isAssignable (from2 , to2 ), "Class<TestImpl> should not be assignable to Class<? extends TestIF<?>>" );
787-
788- final ParameterizedType topre3 = TypeUtils .parameterize (TestIF .class , Number .class );
789- final Type to3 = TypeUtils .parameterize (Class .class , TypeUtils .wildcardType ().withUpperBounds (topre3 ).build ());
790- final Type from3 = TypeUtils .parameterize (Class .class , TestImpl2 .class );
791- assertFalse (TypeUtils .isAssignable (from3 , to3 ), "Class<TestImpl2> should not be assignable to Class<? extends TestIF<Number>>" );
792- }
793-
794- private interface TestIF <T > {
795- }
796-
797- private static class TestImpl <T > implements TestIF <T > {
798- }
799-
800- private static class TestImpl2 <R > implements TestIF <Number > {
801- }
802-
803803 @ Test
804804 void testIsAssignableGenericClassHierarchy () throws NoSuchFieldException {
805805 /*
0 commit comments