diff --git a/src/main/java/dev/openfeature/sdk/EvaluationContext.java b/src/main/java/dev/openfeature/sdk/EvaluationContext.java index 10a7ea17..02fc2401 100644 --- a/src/main/java/dev/openfeature/sdk/EvaluationContext.java +++ b/src/main/java/dev/openfeature/sdk/EvaluationContext.java @@ -7,12 +7,6 @@ package dev.openfeature.sdk; @SuppressWarnings("PMD.BeanMembersShouldSerialize") public interface EvaluationContext extends Structure { String getTargetingKey(); - - /** - * Mutating targeting key is not supported in all implementations and will be removed. - */ - @Deprecated - void setTargetingKey(String targetingKey); /** * Merges this EvaluationContext object with the second overriding the this in diff --git a/src/main/java/dev/openfeature/sdk/ImmutableContext.java b/src/main/java/dev/openfeature/sdk/ImmutableContext.java index 3fb25c28..486e789e 100644 --- a/src/main/java/dev/openfeature/sdk/ImmutableContext.java +++ b/src/main/java/dev/openfeature/sdk/ImmutableContext.java @@ -58,15 +58,6 @@ public final class ImmutableContext implements EvaluationContext { this.targetingKey = targetingKey; } - /** - * Mutating targeting key is not supported in ImmutableContext and will be removed. - */ - @Override - @Deprecated - public void setTargetingKey(String targetingKey) { - throw new UnsupportedOperationException("changing of targeting key is not allowed"); - } - /** * Merges this EvaluationContext object with the passed EvaluationContext, overriding in case of conflict. * diff --git a/src/test/java/dev/openfeature/sdk/EvalContextTest.java b/src/test/java/dev/openfeature/sdk/EvalContextTest.java index d2fbb3ac..29fd0898 100644 --- a/src/test/java/dev/openfeature/sdk/EvalContextTest.java +++ b/src/test/java/dev/openfeature/sdk/EvalContextTest.java @@ -164,8 +164,8 @@ public class EvalContextTest { @Test void merge_targeting_key() { String key1 = "key1"; - EvaluationContext ctx1 = new MutableContext(key1); - EvaluationContext ctx2 = new MutableContext(); + MutableContext ctx1 = new MutableContext(key1); + MutableContext ctx2 = new MutableContext(); EvaluationContext ctxMerged = ctx1.merge(ctx2); assertEquals(key1, ctxMerged.getTargetingKey()); diff --git a/src/test/java/dev/openfeature/sdk/ImmutableContextTest.java b/src/test/java/dev/openfeature/sdk/ImmutableContextTest.java index 437e4922..df5784b6 100644 --- a/src/test/java/dev/openfeature/sdk/ImmutableContextTest.java +++ b/src/test/java/dev/openfeature/sdk/ImmutableContextTest.java @@ -12,13 +12,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; class ImmutableContextTest { - @Test - @DisplayName("Mutating targeting key is not allowed on Immutable Context") - void shouldThrowUnsupportedExceptionWhenMutatingTargetingKey() { - EvaluationContext ctx = new ImmutableContext("targeting key", new HashMap<>()); - assertThrows(UnsupportedOperationException.class, () -> ctx.setTargetingKey("")); - } - @DisplayName("attributes mutation should not affect the immutable context") @Test void shouldCreateCopyOfAttributesForImmutableContext() {