Skip to content

Update OpenFeature SDK dependency range due to compilation failure and binary incompatibility #40

@blesson-rajan-babu

Description

@blesson-rajan-babu

Summary

The dev.openfeature:sdk dependency range is currently set to [1.13.0,2.0.0). This range spans two breaking API changes: SDK versions below 1.13.0 and 1.14.0 fail to compile, and versions below 1.16.0 use void return types for EventProvider.emit*() methods which are binary-incompatible with the Awaitable return type used in 1.16.0+.

Compilation Error

Compiling against SDK versions [1.13.0,1.14.1) produces two errors.

Provider.java:237: error: method getValue in interface Structure cannot be applied to given types;
    if (details.getValue().isPresent()) {
                ^
  required: String
  found:    no arguments

Provider.java:238: error: method getValue in interface Structure cannot be applied to given types;
    metricValue = (Double) details.getValue().get();
                                  ^
  required: String
  found:    no arguments

Binary Incompatibility

The latest published build (1.1.1) is binary incompatible with dev.openfeature:sdk 1.16.0+. The EventProvider methods (emitProviderReady, emitProviderError, emitProviderStale, emitProviderConfigurationChanged) changed their return type from void to Awaitable. The LaunchDarkly provider discards these return values, so this is source-compatible but binary-incompatible when the implementations use dev.openfeature:sdk 1.16.0+.

To reproduce this error, use the dev.openfeature:sdk 1.16.0+ and create the Provider with an invalid SDK key and create an OpenFeature instance with that provider. The following error is logged.

23:28:56.593 [main] WARN com.launchdarkly.sdk.server.LDClient -- LaunchDarkly client was not successfully initialized
Exception in thread "main" java.lang.NoSuchMethodError: 'void com.launchdarkly.openfeature.serverprovider.Provider.emitProviderError(dev.openfeature.sdk.ProviderEventDetails)'
	at com.launchdarkly.openfeature.serverprovider.Provider.handleDataSourceStatus(Provider.java:205)
	at com.launchdarkly.openfeature.serverprovider.Provider.initialize(Provider.java:162)
	at dev.openfeature.sdk.FeatureProviderStateManager.initialize(FeatureProviderStateManager.java:26)
	at dev.openfeature.sdk.ProviderRepository.initializeProvider(ProviderRepository.java:213)
	at dev.openfeature.sdk.ProviderRepository.prepareAndInitializeProvider(ProviderRepository.java:183)
	at dev.openfeature.sdk.ProviderRepository.setProvider(ProviderRepository.java:127)
	at dev.openfeature.sdk.OpenFeatureAPI.setProviderAndWait(OpenFeatureAPI.java:219)
	at com.example.LDBugTest.main(LDBugTest.java:10)

Potential Fix

Raising the lower bound of dev.openfeature:sdk to 1.16.0 fixes both issues. Bumping minor version 1.1.1 → 1.2.0 is suggested.

Additional Note:
The existing test LifeCycleTest.canShutdownAnOfflineClient fails regardless of this change and is a pre-existing issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions