On Fri, 10 Dec 2021 17:03:49 GMT, Liam Miller-Cushon <cus...@openjdk.org> wrote:

>> This change updates the serialized objects used by 
>> `java/awt/dnd/BadSerializationTest/BadSerializationTest.java` using a 
>> similar approach to the previous fix in 
>> [JDK-8039082](https://bugs.openjdk.java.net/browse/JDK-8039082).
>
> Liam Miller-Cushon has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Add a few more missing calls to LookAndFeel.uninstallColors

I see the problem: the constructors do not allow setting invalid values to the 
fields. This is what the *special version of JDK* refers to, the build where 
the checks for invalid values are removed from the constructors. It explains 
why the serialized form can't be obtained by writing an object out, it's 
impossible to create such an object.

I wonder if it's possible to modify the value of the field using reflection via 
`setAccessible(true)`. With strong encapsulation, it may not work. If it works, 
the objects with invalid can be serialized on the fly.

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

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

Reply via email to