Reduced set of classes that are initialized at build time by Native Image

Vojin Jovanovic VOJIN.JOVANOVIC at ORACLE.COM
Mon Jul 6 09:56:05 UTC 2020


Hi all,

We plan to reduce the set of classes that are initialized at build time by default in GraalVM Native Image. We plan to do this because for many JDK packages (e.g., `java.awt’) the cost of maintaining initialization at build time outweighs the performance benefits. The issue that covers this change is 
 
 https://github.com/oracle/graal/issues/2650

and the corresponding PR is 

 https://github.com/oracle/graal/pull/2656

The plan is to merge this feature at the end of the week (before the cut-off for the 20.2 release). I will try to shrink the list of initialized packages even further (https://github.com/oracle/graal/pull/2656/files#diff-fe1c43eaa0fc9417273054562118a946). However, future changes of this list should be small compared to what is already done.

This might be a breaking change for any project that uses Native Image and initializes classes at build time: JDK classes that got accidentally initialized will report an error, and JDK objects that end up in the image heap will report an error. 

The fix should be straightforward: either don’t initialize your project classes at build time, or simply add the initialized (or snapshotted) classes to the list of initializations with `—initialize-at-build-time`. 

Please comment on the PR if you have ideas, concerns, or unexpected issues with your project. 

Thanks,
- Vojin 


More information about the graal-dev mailing list