Skip to content

fix: ISSUE-1919 Domain client event handlers no longer disappear#1922

Open
man85 wants to merge 1 commit intoopen-feature:mainfrom
man85:fix/issues-1919-provider-event-handlers-disappearing
Open

fix: ISSUE-1919 Domain client event handlers no longer disappear#1922
man85 wants to merge 1 commit intoopen-feature:mainfrom
man85:fix/issues-1919-provider-event-handlers-disappearing

Conversation

@man85
Copy link
Copy Markdown

@man85 man85 commented Apr 2, 2026

This PR

  • fixes disappearing of Domain client event handlers

Related Issues

Fixes #1919

Notes

Follow-up Tasks

How to test

@man85 man85 requested review from a team as code owners April 2, 2026 17:53
Copy link
Copy Markdown
Contributor

@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 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.

Comment on lines +121 to +123
// 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());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
// 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());

Copy link
Copy Markdown
Author

@man85 man85 Apr 3, 2026

Choose a reason for hiding this comment

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

The suggestion to use Set.copyOf was removed

@man85 man85 changed the title ISSUE-1919 Fixed: Domain client event handlers no longer disappear fix: ISSUE-1919 Domain client event handlers no longer disappear Apr 2, 2026
@man85 man85 force-pushed the fix/issues-1919-provider-event-handlers-disappearing branch from 1a71f09 to 701c7b8 Compare April 2, 2026 17:59
@man85 man85 force-pushed the fix/issues-1919-provider-event-handlers-disappearing branch from 701c7b8 to 9b3ce4a Compare April 3, 2026 05:06
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 3, 2026

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.

BUG: Provider event handlers are disappearing

1 participant