isaric opened a new pull request, #1549: URL: https://github.com/apache/commons-lang/pull/1549
## Summary Fixes incorrect assignability checks for parameterized types with nested generic arguments. ## Problem `TypeUtils.isAssignable()` incorrectly returned `true` when checking if `MyComparator<Iterable<MyNonTransientException>>` is assignable to `MyComparator<? super MyNonTransientException>`. This happened because the type variable unrolling logic in `getTypeArguments()` didn't properly resolve nested generic arguments when traversing the inheritance hierarchy. ## Changes - **Enhanced `getTypeArguments()`**: When walking up the inheritance hierarchy, now properly unrolls type variables in parameterized parent types before recursing, ensuring nested generic arguments are correctly resolved - **Fixed infinite recursion in `unrollVariables()`**: Added a `visited` set to track already-visited `TypeVariable` instances, preventing infinite loops when circular type variable references exist - **Fixed in-place mutation**: Now clones type argument arrays before modifying them to avoid unintended side effects - **Added test coverage**: New `test_LANG_1700()` validates the fix with a complex parameterized type hierarchy ## Test Case The test verifies that `LexOrdering<MyNonTransientException>` (which implements `MyComparator<Iterable<MyNonTransientException>>`) is correctly identified as **not** assignable to `MyComparator<? super MyNonTransientException>`, since `Iterable<MyNonTransientException>` is not a supertype of `MyNonTransientException`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
