JDK-8342574 : Remove VM implementation that bypass verification for core reflection
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 24
  • Submitted: 2024-10-18
  • Updated: 2024-10-22
  • Resolved: 2024-10-22
Related Reports
CSR :  
Description
Summary
-------

Remove the undocumented system property  `-Djdk.reflect.useOldSerializableConstructor=true` and the old implementation of `sun.reflect.ReflectionFactory::newConstructorForSerialization`.

Problem
-------

JDK-8315811 reimplements `sun.reflect.ReflectionFactory::newConstructorForSerialization` with method handles and adds an undocumented system property `-Djdk.reflect.useOldSerializableConstructor=true` to workaround any issue in JDK 22.   This issue proposes to remove the system property and old implementation. 

Solution
--------

Remove the undocumented system property  `-Djdk.reflect.useOldSerializableConstructor=true` as well as the old implementation of `sun.reflect.ReflectionFactory::newConstructorForSerialization`.

Specification
-------------

After this change, setting `-Djdk.reflect.useOldSerializableConstructor=true` system property has no effect.  Note that this system property is undocumented and no documentation needs to be updated.



Comments
Moving to Approved.
22-10-2024

Release note for JDK-8315810 [1] describes the compatibility concern but never mentions the workaround. IMO a release note for this is not needed. [1] https://bugs.openjdk.org/browse/JDK-8317113
18-10-2024

Good cleanup, no real compatibility issue as jdk.reflect.useOldSerializableConstructor was never documented and unlikely anything depends on it. Coin toss as to whether a release note needed.
18-10-2024