Skip to content

Conversation

@liran2000
Copy link
Member

@liran2000 liran2000 commented Nov 23, 2025

Migrated to Java Core according to Migration guide.

solves #1627.

@lindner and others you are welcome to review

Signed-off-by: liran2000 <[email protected]>
@liran2000 liran2000 requested a review from a team as a code owner November 23, 2025 08:11
@gemini-code-assist
Copy link

Summary of Changes

Hello @liran2000, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a significant upgrade of the Statsig Java SDK within the OpenFeature provider, transitioning from the legacy serversdk to the modern javacore library. This migration involves comprehensive updates to dependencies, adaptation to new API patterns for SDK initialization and feature evaluation, and refinement of the data structures used to represent Statsig configurations. The changes ensure the provider remains compatible with the latest Statsig Java offerings and enhances its interaction with the underlying SDK.

Highlights

  • Dependency Migration: The Statsig Java SDK dependency has been migrated from com.statsig:serversdk to com.statsig:javacore, updating the project to use the latest core library.
  • API Adaptation: The integration with Statsig has been updated to align with the new javacore API, including changes to Statsig initialization (now instance-based instead of static calls) and how feature gates, dynamic configs, and layers are fetched and evaluated.
  • StatsigUser Builder Pattern: The creation of StatsigUser objects now utilizes a builder pattern, reflecting changes in the javacore library's design.
  • Object Structure Simplification: The representation of DynamicConfig and Layer objects within the OpenFeature context has been simplified, removing fields like groupName and secondaryExposures that are handled differently or no longer directly exposed by the new SDK.
  • Test Suite Updates: Existing test cases have been modified to accommodate the new API and object structures, including adjustments to mocking behavior and assertion logic.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully migrates the Statsig provider to the new Java Core SDK. The changes are comprehensive, updating the provider logic, configuration, and tests to align with the new API, such as using builders, handling async operations with CompletableFuture, and using a non-static SDK instance. The tests have been notably improved by using mocking for SDK classes. My review includes suggestions to remove leftover debugging statements and commented-out code, fix a minor typo in the README, and enhance a test case for better robustness.

## Release Notes

### 0.3.0
Migrated to according to [Migration guide](https://docs.statsig.com/server-core/migration-guides/java#java-migration-steps).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a minor grammatical error in the release notes. It should be "Migrated according to..." instead of "Migrated to according to...".

Suggested change
Migrated to according to [Migration guide](https://docs.statsig.com/server-core/migration-guides/java#java-migration-steps).
Migrated according to [Migration guide](https://docs.statsig.com/server-core/migration-guides/java#java-migration-steps).

Comment on lines 81 to 83
// if (!assumeFailure(featureGate)) {
// evaluatedValue = featureGate.getValue();
// }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This commented-out code is no longer necessary with the new Statsig SDK and should be removed to improve code clarity.

Signed-off-by: liran2000 <[email protected]>
Copy link

@lindner lindner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, just some minor nits, since I'm starting with JavaCore. Others who are already using this provider may have issues if the transitive deps have changed significantly.

StatsigOptions statsigOptions = new StatsigOptions();
statsigOptions.setLocalMode(true);
StatsigOptions statsigOptions = new StatsigOptions.Builder()
// .setLocalMode(true)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove? Or make it such that the test passes with/without?

<version>1.18.1</version>
<artifactId>javacore</artifactId>
<version>0.12.1</version>
<classifier>uber</classifier>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this uber? Does this include all of the transitive compiled versions for various platforms?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From docs:

The uber JAR is recommended for most use cases as it includes native libraries for all popular platforms and simplifies deployment. Use platform-specific JARs only if you need to minimize JAR size or have specific dependency requirements.

Recommended: Using the Uber JAR (All-in-One)
Since version 0.4.0, Statsig provides an “uber” JAR that contains both the core library and native libraries for popular supported platforms in a single package. This is the recommended approach for most users.

Since we are like a library here for multi-platform, this includes all, and consumers can control it more precisely if wanted.

## Release Notes

### 0.3.0
Migrated to Java Core according to [Migration guide](https://docs.statsig.com/server-core/migration-guides/java#java-migration-steps).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely mention that this is a major breaking change and that there is migration needed. Also mention that the last version of non-javacore requires a downgrade.

Copy link
Member Author

@liran2000 liran2000 Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

marked as a breaking change at the PR title for release notes and added this to the readme:

The provider usage is basically unchanged, the underlying implementation is changed.
As the initialization code may change, can refer to the migration guide for details.

mutableContext.add("name", dynamicConfig.getName());
mutableContext.add("value", Structure.mapToStructure(dynamicConfig.getValue()));
mutableContext.add("ruleID", dynamicConfig.getRuleID());
mutableContext.add("groupName", dynamicConfig.getGroupName());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these provided in a different way? If so document in the README.md

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documented

log.info("shutdown");
Statsig.shutdown();
log.info("shutdown begin");
CompletableFuture<Void> shutdownFuture = statsig.shutdown();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if statsig != null?

@liran2000 liran2000 changed the title feat(statsig): Migrate to Java Core feat(statsig)!: Migrate to Java Core Nov 25, 2025
Signed-off-by: liran2000 <[email protected]>
@liran2000 liran2000 requested a review from lindner November 25, 2025 06:18
Signed-off-by: liran2000 <[email protected]>
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.

2 participants