On Thu, 9 Feb 2023 18:48:19 GMT, Adam Sotona <asot...@openjdk.org> wrote:

>> java.base java.lang.reflect.ProxyGenerator uses ASM to generate proxy 
>> classes and this patch converts it to use Classfile API.
>> 
>> Please review.
>> 
>> Thank you,
>> Adam
>
> Adam Sotona has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains six additional 
> commits since the last revision:
> 
>  - j.l.r.ProxyGenerator improvements
>    Author: Mandy Chung <mch...@openjdk.org>
>  - Merge branch 'JDK-8294982' into JDK-8294961
>  - j.l.r.ProxyGenerator fix - Classfile API moved under 
> jdk.internal.classfile package
>  - Merge branch 'JDK-8294982' into JDK-8294961
>  - Merge branch 'JDK-8294982' into JDK-8294961
>  - 8294961: java.base java.lang.reflect.ProxyGenerator uses ASM to generate 
> proxy classes

src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java line 661:

> 659:          */
> 660:         private void generateMethod(ClassBuilder clb, ClassDesc 
> className) {
> 661:             MethodTypeDesc desc = MethodType.methodType(returnType, 
> parameterTypes).describeConstable().orElseThrow();

Can we convert this line to:

MethodTypeDesc desc = MethodTypeDesc.of(toClassDesc(returnType), 
Arrays.stream(parameterTypes).map(ProxyGenerator::toClassDesc).toArray(ClassDesc[]::new));


Mainly due to that `MethodType` creation involves a lot of unrelated process 
such as generating lambda forms, and we can remove the `MethodType` import as a 
result.

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

PR: https://git.openjdk.org/jdk/pull/10991

Reply via email to