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

Liam Miller-Cushon cushon at openjdk.java.net
Wed Dec 1 18:18:27 UTC 2021


On Wed, 1 Dec 2021 04:41:39 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> I couldn't find the review either.
>> 
>> I regenerated it by following the instructions to compile and run the test class as a standalone tool on `x86_64 GNU/Linux`, which updated all of the existing files. I verified it fixes the test on that platform, I don't have a great way to test it on the other platforms right now.
>> 
>> * https://github.com/openjdk/jdk/blob/5a4a9bb9d55134deac0e02cf37f31d1dd2223024/test/jdk/java/awt/dnd/BadSerializationTest/BadSerializationTest.java#L64-L65
>> 
>> * https://github.com/openjdk/jdk/blob/5a4a9bb9d55134deac0e02cf37f31d1dd2223024/test/jdk/java/awt/dnd/BadSerializationTest/BadSerializationTest.java#L95-L96
>> 
>> I started investigating this when I thought it was related to [JDK-8271623](https://bugs.openjdk.java.net/browse/JDK-8271623), if anyone wants to take this over (especially now that it's problem-listed) please feel free :)
>
>> I regenerated it by following the instructions to compile and run the test class as a standalone tool on `x86_64 GNU/Linux`, which updated all of the existing files. I verified it fixes the test on that platform, I don't have a great way to test it on the other platforms right now.
> 
> As far as I remember the previous fix regenerated the binary files only, for a specific reason - before that a couple of commits fixed a memory leak which prevents the Aqua L&F deletes all its delegates during cleanup step. This cleanup step is executed in two cases, when we serialize the component or when we switch one L&F to another.
> 
> Since the fix for JDK-8276665 exposed another bug you will need:
>  1. Regenerate the data on macOS
>  2. If the test will fail while use the new regenerated data, then you will need to fix the Aqua to properly delete the references to the Aqua specific objects.

Thanks @mrserb! I regenerated the binary files on macOS, and that caused the test to fail on linux.

I don't have a lot of context here, but as far as I can tell `BasicPanelUI` was installing (but not uninstalling) a reference to the color `Panel.background`, which for Aqua is an instance of `com.apple.laf.AquaImageFactory$SystemColorProxy`.

* https://github.com/openjdk/jdk/blob/a363b7b9217cbb9a7580a87b812da8d5a4215326/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPanelUI.java#L81-L83

* https://github.com/openjdk/jdk/blob/4efcd2006f00a6347987ecdacd6e09d59a0006f4/src/java.desktop/macosx/classes/com/apple/laf/AquaLookAndFeel.java#L391-L392

* https://github.com/openjdk/jdk/blob/4efcd2006f00a6347987ecdacd6e09d59a0006f4/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java#L469-L471

I included a fix to `BasicPanelUI`, but the test now fails with a different issue:


Caused by: java.lang.ClassNotFoundException: com.apple.laf.AquaFonts$DerivedUIResourceFont
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)

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

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



More information about the client-libs-dev mailing list