Skip to content

Allow fluent use of InetAddressMatchers#builder#19074

Open
therepanic wants to merge 1 commit intospring-projects:mainfrom
therepanic:gh-19071
Open

Allow fluent use of InetAddressMatchers#builder#19074
therepanic wants to merge 1 commit intospring-projects:mainfrom
therepanic:gh-19071

Conversation

@therepanic
Copy link
Copy Markdown
Contributor

The main goal of this commit is to allow fluent use of InetAddress Matchers#builder to be called in a fluent manner.

Previously, calling includeAddresses twice would cause the logic to stop working, since our IP address can't be equal to two addresses in the list at the same time.

I think the current behavior is rather non-obvious, and we should definitely implement this change.

Closes: gh-19071

The main goal of this commit is to allow fluent use of `InetAddress
Matchers#builder` to be called in a fluent manner.

Previously, calling `includeAddresses` twice would cause the logic to
stop working, since our IP address can't be equal to two addresses in
the list at the same time.

I think the current behavior is rather non-obvious, and we should
definitely implement this change.

Closes: spring-projectsgh-19071

Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 14, 2026
Comment on lines +98 to +100
private final Set<String> includeAddresses = new LinkedHashSet<>();

private final Set<String> excludeAddresses = new LinkedHashSet<>();
Copy link
Copy Markdown
Contributor Author

@therepanic therepanic Apr 14, 2026

Choose a reason for hiding this comment

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

Would it be more obvious if we used LinkedHashSet? When debugging, the user will see the addresses added to the list in the order they were added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow InetAddressMatchers.builder().include(...) to be called in a fluent style

2 participants