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
The core issue is some parts of Guava use JDK features that are not compatible with GraalVM's native-image feature.
Some objectives:
native-image.properties file is included in the META-INF / jar artifacts of Guava to be used by native-image -jar user-shadow-jar.jar build pipeline.
Reflection, proxy and JNI configuration files included in the META-INF and referenced by the native-image.properties.
All of Guava can be initialized at build time using the native-image argument --initialize-at-build-time=com.google.
The biggest obstacle is some classes use native heap features which are not allowed for static initialization at build time. netty uses feature detection for this issue.
FAQ
Why is native-image valuable really?
Serverless applications and building Java applications for containers and mobile devices.
What are current workarounds?
Static initialize only the specific Guava classes you need, and stop using the ones that are inherently incompatible. Usually the incompatibilities come from a transitive dependency on Objects which has an empty static initializer anyway. Repeatedly run native-image and add the classes it reports you need.
Avoid anything that does native heap allocation like the cache classes.
How can I make this about Google Cloud support for Java?
native-image support in Guava would make it easier to use a common Google Java library for serverless / cloud functions.
The text was updated successfully, but these errors were encountered:
Consumers of Guava in a
native-image
built.jar
would benefit fromnetty
's approach withnative-image.properties
andorg.graalvm.nativeimage.imagecode
(see netty/netty#8192 and https://github.com/netty/netty/pulls?q=is%3Apr+svm for what this entails).The core issue is some parts of Guava use JDK features that are not compatible with GraalVM's
native-image
feature.Some objectives:
native-image.properties
file is included in theMETA-INF
/jar
artifacts of Guava to be used bynative-image -jar user-shadow-jar.jar
build pipeline.META-INF
and referenced by thenative-image.properties
.native-image
argument--initialize-at-build-time=com.google
.The biggest obstacle is some classes use native heap features which are not allowed for static initialization at build time.
netty
uses feature detection for this issue.FAQ
Why is
native-image
valuable really?Serverless applications and building Java applications for containers and mobile devices.
What are current workarounds?
Objects
which has an emptystatic
initializer anyway. Repeatedly runnative-image
and add the classes it reports you need.How can I make this about Google Cloud support for Java?
native-image
support inGuava
would make it easier to use a common Google Java library for serverless / cloud functions.The text was updated successfully, but these errors were encountered: