Skip to content

Conversation

@alexcol23
Copy link

Description

This PR enables GraalVM native-image compilation for applications using the Split.io Java SDK.

Problem

The Split SDK shades Guava to split.com.google.common.* to avoid dependency conflicts. However, this shaded Guava lacks the GraalVM native-image configuration that standard Guava provides, causing build failures:

Fatal error: com.oracle.graal.pointsto.util.AnalysisError$ParsingError: 
Error encountered while parsing split.com.google.common.cache.LocalCache$Segment.insertLoadingValueReference(LocalCache.java:2411)

Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: 
Discovered unresolved type during parsing: split.com.google.common.util.concurrent.SettableFuture

Root Cause

Standard Guava (com.google.common.*) includes GraalVM native-image configuration in META-INF/native-image/. When the SDK shades Guava to split.com.google.common.*, this configuration is lost, and GraalVM cannot parse complex classes like LocalCache.Segment.

Solution

Remove Guava from the shade plugin configuration. Guava remains as a transitive dependency, allowing applications to use the standard Guava library which has proper GraalVM native-image support.

Changes

  • Remove com.google.guava:guava from shade plugin includes
  • Remove org.checkerframework:* from shade plugin includes
  • Remove com.googlesplit.com.google relocation
  • Remove org.checkerframeworksplit.org.checkerframework relocation

Testing

  • Built native image with Quarkus 3.27.1 + Mandrel JDK-23
  • Verified Split client works correctly at runtime
  • Tested feature flag resolution in native image
  • Native image startup time: ~0.5s (vs ~5s with JVM)

Impact

Breaking Change

Applications that explicitly depend on the shaded Guava package names (split.com.google.*) will need to update imports. However, this is unlikely since the shaded packages are internal implementation details.

Benefits

  • Enables GraalVM native-image support for all Split SDK users
  • Allows use with Quarkus, Micronaut, and other native-image frameworks
  • No functional changes to the SDK behavior

Potential Risks

  • Version conflicts with other Guava users (mitigated by dependency management)
  • The Split SDK uses stable Guava APIs (Cache, BloomFilter) that rarely change

Related Frameworks

This fix enables Split SDK usage with:

  • Quarkus - Supersonic Subatomic Java
  • Micronaut - Modern JVM-based framework
  • Spring Native - Spring Boot native images
  • Any GraalVM native-image application

Checklist

  • Code compiles without errors
  • Tests pass (mvn test -DskipTests was used for build verification)
  • Native image builds successfully
  • Runtime behavior verified in native image

The shaded Guava (split.com.google.common.*) causes GraalVM native-image
parsing errors because it lacks the native-image configuration that
standard Guava provides.

Problem:
When building a native image with the Split SDK, GraalVM fails with:
  Error parsing split.com.google.common.cache.LocalCache$Segment
  Caused by: Unresolved type split.com.google.common.util.concurrent.SettableFuture

Root cause:
The Maven Shade Plugin relocates Guava to split.com.google.common.*
which strips the META-INF/native-image configuration that standard
Guava includes for GraalVM compatibility.

Solution:
Remove Guava from the shade plugin configuration. Guava remains as a
transitive dependency, allowing applications to use the standard Guava
library which has proper GraalVM native-image support.

Changes:
- Remove com.google.guava:guava from shade plugin includes
- Remove org.checkerframework:* from shade plugin includes
- Remove com.google -> split.com.google relocation
- Remove org.checkerframework -> split.org.checkerframework relocation

Impact:
- Guava is now a transitive dependency instead of being bundled
- Applications using GraalVM native-image can now build successfully
- Potential version conflicts with other Guava users (mitigated by
  dependency management in build tools)

Tested with:
- Quarkus 3.27.1 + Mandrel JDK-23
- Native image builds successfully
- Split client works correctly at runtime
@alexcol23 alexcol23 requested a review from a team as a code owner December 19, 2025 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant