AmarGhugare opened a new pull request, #1866: URL: https://github.com/apache/commons-lang/pull/1866
`TypeUtils.normalizeUpperBounds()` removes both bounds when given separate but equal `ParameterizedType` or `GenericArrayType` instances. For example, two independently created `List<String>` types normalize to an empty array instead of one `List<String>` bound. This also affects wildcard assignability: ```java Type first = TypeUtils.parameterize(List.class, String.class); Type second = TypeUtils.parameterize(List.class, String.class); WildcardType wildcard = TypeUtils.wildcardType().withUpperBounds(first, second).build(); TypeUtils.isAssignable(String.class, wildcard); // Currently true; should be false. ``` The redundancy check compares object identity, so each equivalent bound is treated as a subtype that eliminates the other. Compare type equality before checking assignability, allowing the existing result set to retain one equivalent bound while still removing genuinely broader bounds. Added eight test invocations covering JDK and Commons Lang parameterized types in both orders, generic arrays, redundant supertypes, and downstream wildcard assignability. Seven fail against the original implementation. The existing repeated-`String.class` regression remains covered; that identity-equal case differs from this equal-but-distinct generic-type case. Validation: - `TypeUtilsTest`: 538 invocations, zero failures or errors, one existing skipped test. - Full default Maven build on JDK 25 with Java 8 compilation target: 108,490 tests, zero failures or errors, 18 skipped. Coverage, RAT, Checkstyle, Japicmp, SpotBugs, PMD, and Javadoc checks pass. - `git diff --check` passes. -- 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]
