On Mon, 16 May 2022 15:29:38 GMT, Сергей Цыпанов <d...@openjdk.java.net> wrote:

>> Even in the no exceptions case, the `exceptionTypes` array still has to be 
>> allocated/copied by `Method.getExceptionTypes()`[^1] when the `ProxyMethod` 
>> constructor[^2] is invoked.
>> 
>> So if anything, the `List.of(…)` call should be moved into the `ProxyMethod` 
>> constructor.
>> And maybe the call to `Method.getExceptionTypes()` should be changed to 
>> `Method.getSharedExceptionTypes()`[^3].
>> 
>> [^1]: 
>> https://github.com/openjdk/jdk/blob/e765c42aa71a25a9c30f3409b8fdc6bda6f7b639/src/java.base/share/classes/java/lang/reflect/Method.java#L340-L343
>> [^2]: 
>> https://github.com/openjdk/jdk/blob/e765c42aa71a25a9c30f3409b8fdc6bda6f7b639/src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java#L710-L714
>> [^3]: 
>> https://github.com/openjdk/jdk/blob/e765c42aa71a25a9c30f3409b8fdc6bda6f7b639/src/java.base/share/classes/java/lang/reflect/Method.java#L305-L308
>
>> So if anything, the List.of(…) call should be moved into the ProxyMethod 
>> constructor. And maybe the call to Method.getExceptionTypes() should be 
>> changed to Method.getSharedExceptionTypes()
> 
> Makes sense. Do you want me to do this within this PR (this would be a 
> deviation from ticket's target), or it's better to create another one?

Ok, I've reverted `ProxyGenerator` and will include the changes into another PR

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

PR: https://git.openjdk.java.net/jdk/pull/7729

Reply via email to