Limitations of Graal AOT (Native Image)
In this section, we will go through some of the limitations of Graal AOT and native images.
Graal ahead-of-time compilation performs static analysis with the closed-world assumption. It assumes that all the classes that are reachable at runtime are available during build time. This has a direct implication on writing any code that requires dynamic loading – such as Reflection, JNI, Proxies, and so on. However, the Graal AOT compiler (native-image
) provides a way to provide this metadata in the form of JSON manifest files. These files can be packaged along with the JAR file, as an input for the compiler:
- Loading classes dynamically: Classes that are loaded at runtime, which will not be visible to the AOT compiler at build time, need to be specific in the configuration file. These configuration files are typically saved under
META-INF/native-image/
, and should be inCLASSPATH
. If the class is not found during the compilation of...