You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the native image generator, classes that have side-effect free class initializers should be initialized as early as possible so that the static analysis already sees them as initialized and can constant fold.
Before static analysis, we are restricted to intraprocedural analysis. But method inlining helps: we can inline statically bound methods to grow the analysis scope. If after such inlining the class initializer is side-effect free, i.e., does not read or write any static field outside of its class, then initialization can be done eagerly.
An important use case are enums: All "non-crazy" enums can be initialized by this analysis.