RFR: 8294961: java.base java.lang.reflect.ProxyGenerator uses ASM to generate proxy classes [v3]

Adam Sotona asotona at openjdk.org
Thu Mar 9 17:30:56 UTC 2023


On Sun, 19 Feb 2023 05:23:20 GMT, liach <duke at openjdk.org> wrote:

>> 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 <mchung at 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.

Isn't the "unrelated process such as generating lambda forms" critical for the `ProxyGenerator` functionality?

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

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


More information about the core-libs-dev mailing list