@@ -192,6 +192,23 @@ public static <U> Iterable<U> methodWithGenericReturnType() {
192192 }
193193 }
194194
195+ static class LexOrdering <T > extends MyOrdering <Iterable <T >> implements Serializable {
196+ private static final long serialVersionUID = 1L ;
197+ }
198+
199+ interface MyComparator <T > {
200+ }
201+
202+ static class MyException extends Exception implements Iterable <Throwable > {
203+
204+ private static final long serialVersionUID = 1L ;
205+
206+ @ Override
207+ public Iterator <Throwable > iterator () {
208+ return null ;
209+ }
210+ }
211+
195212 /** This non-static inner class is parameterized. */
196213 private class MyInnerClass <T > {
197214
@@ -200,6 +217,13 @@ class MyInnerClass2<X> {
200217 }
201218 }
202219
220+ static class MyNonTransientException extends MyException {
221+ private static final long serialVersionUID = 1L ;
222+ }
223+
224+ static class MyOrdering <T > implements MyComparator <T > {
225+ }
226+
203227 public class Other <T > implements This <String , T > {
204228 // empty
205229 }
@@ -358,41 +382,6 @@ void test_LANG_1698() {
358382 assertEquals ("java.util.function.Function<? super T, ? extends U>" , typeName );
359383 }
360384
361- @ Test
362- void test_LANG_1702 () throws NoSuchMethodException , SecurityException {
363- final Type type = TypeUtilsTest .class .getDeclaredMethod ("aMethod" ).getGenericReturnType ();
364-
365- // any map will do
366- final Map <TypeVariable <?>, Type > typeArguments = Collections .emptyMap ();
367-
368- // this fails with a stack overflow
369- final Type unrolledType = TypeUtils .unrollVariables (typeArguments , type );
370- }
371-
372- static class MyException extends Exception implements Iterable <Throwable > {
373-
374- private static final long serialVersionUID = 1L ;
375-
376- @ Override
377- public Iterator <Throwable > iterator () {
378- return null ;
379- }
380- }
381-
382- static class MyNonTransientException extends MyException {
383- private static final long serialVersionUID = 1L ;
384- }
385-
386- interface MyComparator <T > {
387- }
388-
389- static class MyOrdering <T > implements MyComparator <T > {
390- }
391-
392- static class LexOrdering <T > extends MyOrdering <Iterable <T >> implements Serializable {
393- private static final long serialVersionUID = 1L ;
394- }
395-
396385 /**
397386 * Tests that a parameterized type with a nested generic argument is correctly
398387 * evaluated for assignability to a wildcard lower-bounded type.
@@ -412,6 +401,17 @@ public void test_LANG_1700() {
412401 () -> String .format ("Type %s should not be assignable to %s" , TypeUtils .toString (from ), TypeUtils .toString (to )));
413402 }
414403
404+ @ Test
405+ void test_LANG_1702 () throws NoSuchMethodException , SecurityException {
406+ final Type type = TypeUtilsTest .class .getDeclaredMethod ("aMethod" ).getGenericReturnType ();
407+
408+ // any map will do
409+ final Map <TypeVariable <?>, Type > typeArguments = Collections .emptyMap ();
410+
411+ // this fails with a stack overflow
412+ final Type unrolledType = TypeUtils .unrollVariables (typeArguments , type );
413+ }
414+
415415 @ Test
416416 void testContainsTypeVariables () throws NoSuchMethodException {
417417 assertFalse (TypeUtils .containsTypeVariables (Test1 .class .getMethod ("m0" ).getGenericReturnType ()));
0 commit comments