RFR: 8287064: Modernize ProxyGenerator.PrimitiveTypeInfo [v3]
Mandy Chung
mchung at openjdk.java.net
Thu May 26 22:58:50 UTC 2022
On Thu, 26 May 2022 20:55:53 GMT, liach <duke at openjdk.java.net> wrote:
>> Simplify opcode handling, use `final` in `PrimitiveTypeInfo`, and replace the hash map with a simple lookup, similar to what's done in [JDK-8284880](https://bugs.openjdk.java.net/browse/JDK-8284880) (#8242)
>
> liach 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 three additional commits since the last revision:
>
> - Merge branch 'master' into proxy-primitivetypeinfo
> - Convert PrimitiveTypeInfo to an enum
> - 8287064: Modernize ProxyGenerator.PrimitiveTypeInfo
Have you considered including the opcode for load and return instruction instead of `opcodeOffset`?
src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java line 969:
> 967: // single-char BaseType descriptor (see JVMS section 4.3.2)
> 968: String baseTypeString = wrapper.basicTypeString();
> 969: wrapperClassName = dotToSlash(wrapper.wrapperType().getName());
Suggestion:
wrapperClassName = wrapper.wrapperType().descriptorString();
It may worth to replace similar use of `dotToSlash(c.getName())` pattern.
src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java line 986:
> 984: if (cl == float.class) return FLOAT;
> 985: if (cl == double.class) return DOUBLE;
> 986: throw new AssertionError();
Suggestion:
throw new AssertionError(cl);
-------------
PR: https://git.openjdk.java.net/jdk/pull/8801
More information about the core-libs-dev
mailing list