Skip to content

Commit

Permalink
Break class initialization cycle in XML classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Wimmer committed Jan 27, 2024
1 parent 8a010c6 commit b78434a
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ public void afterRegistration(AfterRegistrationAccess access) {
rci.initializeAtBuildTime("jdk.nio", JDK_CLASS_REASON);
rci.initializeAtBuildTime("jdk.vm.ci", "Native Image classes are always initialized at build time");
rci.initializeAtBuildTime("jdk.xml", JDK_CLASS_REASON);
/*
* The XML classes have cyclic class initializer dependencies, and class initialization can
* deadlock/fail when initialization is started at the "wrong part" of the cycle.
* Force-initializing the correct class of the cycle here, in addition to the
* "whole package" initialization above, breaks the cycle because it triggers immediate
* initilalization here before the static analysis is started.
*/
rci.initializeAtBuildTime("jdk.xml.internal.JdkXmlUtils", JDK_CLASS_REASON);

rci.initializeAtBuildTime("sun.invoke", JDK_CLASS_REASON);
rci.initializeAtBuildTime("sun.launcher", JDK_CLASS_REASON);
Expand Down

0 comments on commit b78434a

Please sign in to comment.