Skip to content

Conversation

@mxschmitt
Copy link
Contributor

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
Contributor 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 glob.equals(that.glob);
}
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
Contributor 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.

3 participants