SOAR complies with the deterministic class initialization (<clinit>) order specified in [BON]. The application is statically analyzed from its entry points in order to generate a clinit dependency graph. The computed clinit sequence is the result of the topological sort of the dependency graph. An error is thrown if the clinit dependency graph contains cycles.

An explicit clinit dependency can be declared by creating an XML file with the .clinitdesc extension in the application classpath. The file has the following format:

<?xml version='1.0' encoding='UTF-8'?>
    <type name="T1" depends="T2"/>

where T1 and T2 are fully qualified names on the form a.b.C. This explicitly forces SOAR to create a dependency from T1 to T2, and therefore cuts a potentially detected dependency from T2 to T1.

A clinit map file (ending with extension .clinitmap) is generated beside the SOAR object file. It describes for each clinit dependency:

  • the types involved
  • the kind of dependency
  • the stack calls between the two types