RFR: 8277817: java/awt/dnd/BadSerializationTest/BadSerializationTest.java failed: ClassNotFoundException: com.apple.laf.AquaImageFactory$SystemColorProxy [v9]

Alexey Ivanov aivanov at openjdk.java.net
Fri Dec 17 22:00:26 UTC 2021


On Fri, 10 Dec 2021 17:03:49 GMT, Liam Miller-Cushon <cushon at 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



More information about the client-libs-dev mailing list