RFR: 8275137: jdk.unsupported/sun.reflect.ReflectionFactory.readObjectNoDataForSerialization uses wrong signature

Daniel Fuchs dfuchs at openjdk.java.net
Thu Oct 14 15:07:50 UTC 2021


On Thu, 14 Oct 2021 14:44:34 GMT, Julia Boes <jboes at openjdk.org> wrote:

> sun.reflect.ReflectionFactory provides MethodHandles for the various serialization methods, it is a critical internal API in the jdk.unsupported module (see JEP 260 [1]) that may be used by 3rd party serialization libraries. 
> 
> One of these serialization methods is readObjectNoData [2]:
> 
> ```private void readObjectNoData() throws ObjectStreamException;```
> 
> The issue: The method that returns the matching handle, sun.reflect.ReflectionFactory.readObjectNoDataForSerialization, uses an erroneous signature `readObjectNoData(ObjectInputStream)` - note the superfluous parameter.
> 
> This change updates the specification and fixes the implementation in java.base/jdk.internal.reflect.ReflectionFactory.
> 
> Testing: tier 1-3
> 
> [1] https://openjdk.java.net/jeps/260
> [2] https://docs.oracle.com/en/java/javase/15/docs/specs/serialization/input.html#the-readobjectnodata-method

LGTM.
The update on the `throws` declaration in the test is a bit of a distraction.

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

Marked as reviewed by dfuchs (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/5951


More information about the core-libs-dev mailing list