Skip to content
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

chore: refactor UrlMatcher #1720

Merged
merged 4 commits into from
Dec 28, 2024
Merged

chore: refactor UrlMatcher #1720

merged 4 commits into from
Dec 28, 2024

Conversation

mxschmitt
Copy link
Member

Extracted from #1717. There should be no behaviour changes.

This moves rawSource towards having it lazily determined which matching source it is - this helps us to align with upstream.

static UrlMatcher any() {
return new UrlMatcher((Object) null, null);
}
private final URL baseURL;
Copy link
Member

Choose a reason for hiding this comment

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

Why not resolve the pattern in the constructor and avoid plumbing base url all the way through?

Copy link
Member Author

Choose a reason for hiding this comment

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

@mxschmitt mxschmitt force-pushed the refactore-UrlMatcher branch from d564bc4 to fb252dc Compare December 19, 2024 20:46
@mxschmitt mxschmitt force-pushed the refactore-UrlMatcher branch from 9f6a2a8 to e31f5d3 Compare December 19, 2024 22:16
@mxschmitt mxschmitt force-pushed the refactore-UrlMatcher branch from e31f5d3 to 97def24 Compare December 19, 2024 22:25
}
return Objects.equals(rawSource, that.rawSource);
return true;
Copy link
Member

Choose a reason for hiding this comment

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

I believe it should be return that.pattern == null && that.predicate == null && that.glob == null;, otherwise it will be equal to any other pattern.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I already have it like that.

Copy link
Member

Choose a reason for hiding this comment

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

I disagree, with the current code e.g.new UrlMatcher(null, null, null, null).equals(new UrlMatcher((String s) -> true) == true which is incorrect.

@mxschmitt mxschmitt merged commit 6b621ce into main Dec 28, 2024
12 of 19 checks passed
@mxschmitt mxschmitt deleted the refactore-UrlMatcher branch December 28, 2024 09:47
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.

2 participants