Skip to content

feat: remove the deprecated setTargetingKey method in EvaluationContext. #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/main/java/dev/openfeature/sdk/EvaluationContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
@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
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/dev/openfeature/sdk/ImmutableContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ public ImmutableContext(String targetingKey, Map<String, Value> attributes) {
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.
*
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/dev/openfeature/sdk/EvalContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
7 changes: 0 additions & 7 deletions src/test/java/dev/openfeature/sdk/ImmutableContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@

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() {
Expand Down