RFR: 8315810: Reimplement sun.reflect.ReflectionFactory::newConstructorForSerialization with method handles [v2]
Mandy Chung
mchung at openjdk.org
Tue Sep 12 16:37:28 UTC 2023
> This reimplements `sun.reflect.ReflectionFactory::newConstructorForSerialization` with method handles.
>
> This API currently generates the bytecode which fails the verification because `new C; invokespecial A()` where the given class `C` and invoke a no-arg constructor of `C`'s first non-`Serializable` superclass `A` is not a valid operation per the VM specification. VM special cases the classes generated for reflection to skip verification for the constructors generated for serialization and externalization. This change will allow such VM hack to be removed.
>
> A `jdk.reflect.useOldSerializableConstructor` system property can be set to use the old implementation in case if customers run into any compatibility issue. I expect this change has very low compatibility risk. This system property is undocumented and will be removed in a future release.
Mandy Chung 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' of https://github.com/openjdk/jdk into reflect-serializable-ctor
- minor cleanup
- Reimplement ReflectionFactory::newConstructorForSerialization with method handle
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/15600/files
- new: https://git.openjdk.org/jdk/pull/15600/files/e98b5528..fb3bf590
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=15600&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=15600&range=00-01
Stats: 33895 lines in 1007 files changed: 19846 ins; 9174 del; 4875 mod
Patch: https://git.openjdk.org/jdk/pull/15600.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15600/head:pull/15600
PR: https://git.openjdk.org/jdk/pull/15600
More information about the core-libs-dev
mailing list