On Thu, 20 Nov 2025 13:06:12 GMT, Per Minborg <[email protected]> wrote:

> The `TypeVariableImpl::getGenericDeclaration` method should return copies of 
> generic declarations where appropriate.

src/java.base/share/classes/sun/reflect/generics/reflectiveObjects/TypeVariableImpl.java
 line 142:

> 140:                 genericDeclaration instanceof Method ||
> 141:                 genericDeclaration instanceof Constructor : "Unexpected 
> kind of GenericDeclaration";
> 142:         // If the `genericDeclaration` instance is mutable, we need to 
> make a copy.

Additionally, the old version would leak the internal root `Method` and 
`Constructor` objects.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28429#discussion_r2552861038

Reply via email to