This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new 959178ee9 [LANG-1702] test for LANG-1702 (#1151)
959178ee9 is described below

commit 959178ee9de6e3ffeab0d96703ec623a2b4deb57
Author: Elliotte Rusty Harold <elh...@users.noreply.github.com>
AuthorDate: Wed Jan 3 07:14:16 2024 -0500

    [LANG-1702] test for LANG-1702 (#1151)
    
    * test for LANG-1702
    
    * remove trailing space
    
    * Comments -> Javadoc
    
    ---------
    
    Co-authored-by: Gary Gregory <garydgreg...@users.noreply.github.com>
---
 .../apache/commons/lang3/reflect/TypeUtilsTest.java  | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java 
b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
index 0adb7402d..c5a546cb0 100644
--- a/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/reflect/TypeUtilsTest.java
@@ -315,6 +315,26 @@ public class TypeUtilsTest<B> extends AbstractLangTest {
         assertArrayEquals(expectedArray, 
TypeUtils.normalizeUpperBounds(typeArray));
     }
 
+    /** This non-static inner class is parameterized. */
+    private class MyInnerClass<T> {
+    }
+
+    /** The inner class is used as a return type from a method. */
+    private <U> MyInnerClass<U> aMethod() {
+        return null;
+    }
+
+    @Test
+    public void test_LANG_1702() throws NoSuchMethodException, 
SecurityException {
+        final Type type = 
TypeUtilsTest.class.getDeclaredMethod("aMethod").getGenericReturnType();
+
+        // any map will do
+        final Map<TypeVariable<?>, Type> typeArguments = 
Collections.emptyMap();
+
+        // this fails with a stack overflow
+        final Type unrolledType = TypeUtils.unrollVariables(typeArguments, 
type);
+    }
+
     @Test
     public void testContainsTypeVariables() throws Exception {
         
assertFalse(TypeUtils.containsTypeVariables(Test1.class.getMethod("m0").getGenericReturnType()));

Reply via email to