fix: ISSUE-1919 Domain client event handlers no longer disappear#1922
fix: ISSUE-1919 Domain client event handlers no longer disappear#1922man85 wants to merge 1 commit intoopen-feature:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates EventSupport.java to return a new HashSet of domain names and adds a test case to OpenFeatureAPITest.java to ensure that configuration change events are correctly handled for both domainless and domain-specific providers. A review comment correctly identified that a TODO suggestion in the code regarding Set.copyOf was misleading, as the caller requires a mutable set to perform removeAll operations without triggering an UnsupportedOperationException.
| // TODO Java 8 in documentation https://openfeature.dev/docs/tutorials/getting-started/java/spring-boot/#requirements, but Java 11 in https://github.com/open-feature/java-sdk/pull/1393 | ||
| // 'Set.copyOf' can be used instead of 'new HashSet<>' in case of Java 11 | ||
| return new HashSet<>(this.handlerStores.keySet()); |
There was a problem hiding this comment.
The suggestion to use Set.copyOf is incorrect in this context. Set.copyOf (introduced in Java 10) returns an unmodifiable set. However, the caller of this method in OpenFeatureAPI.runHandlersForProvider (line 466) calls removeAll on the returned set. Using an unmodifiable set would result in an UnsupportedOperationException at runtime. It is safer to remove this misleading comment.
| // TODO Java 8 in documentation https://openfeature.dev/docs/tutorials/getting-started/java/spring-boot/#requirements, but Java 11 in https://github.com/open-feature/java-sdk/pull/1393 | |
| // 'Set.copyOf' can be used instead of 'new HashSet<>' in case of Java 11 | |
| return new HashSet<>(this.handlerStores.keySet()); | |
| return new HashSet<>(this.handlerStores.keySet()); |
There was a problem hiding this comment.
The suggestion to use Set.copyOf was removed
1a71f09 to
701c7b8
Compare
Signed-off-by: man85 <man85@yandex.ru>
701c7b8 to
9b3ce4a
Compare
|



This PR
Related Issues
Fixes #1919
Notes
Follow-up Tasks
How to test