Skip to content

Conversation

@mcculls
Copy link
Collaborator

@mcculls mcculls commented Oct 9, 2025

  • TypeMatcher is a FunctionalInterface
  • Provide strong-type form of not(...)
  • Introduce AccessMatcher functional type
  • Add some common 'negative' access matchers

@mcculls mcculls requested a review from a team as a code owner October 9, 2025 15:42
@mcculls mcculls requested a review from dougqh October 9, 2025 15:42
@mcculls mcculls added enhancement New feature or request no release notes labels Oct 9, 2025
@mcculls mcculls requested review from cecile75 and removed request for dougqh October 9, 2025 15:42
Copy link
Contributor

@PerfectSlayer PerfectSlayer left a comment

Choose a reason for hiding this comment

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

👏 praise: ‏Nice change. It feels way more expressive than the IntPredicate

❔ question: ‏I read the "simple approach comment", just asking if there is any benefits implementing new lambdas over using the existing and(), or() and negate() from IntPredicate and Predicate and casting the output to the expected type?

@mcculls
Copy link
Collaborator Author

mcculls commented Oct 10, 2025

if there is any benefits implementing new lambdas over using the existing and(), or() and negate() from IntPredicate and Predicate and casting the output to the expected type?

Main benefit is carrying the type over - if you use the base IntPredicate.and etc. then the resulting lambda is of type IntPredicate not AccessMatcher. Attempting to cast it to AccessMatcher will fail with a ClassCastException. The only way to retain the AccessMatcher type is using a capturing lambda for the and.

(The other issue about implementing AccessMatcher.and on top of IntPredicate.and is that you have to cast the argument to IntPredicate, otherwise you would cause a recursive loop - so you end up with a lot more casting which is not as performant.)

@mcculls mcculls merged commit a9b9875 into main Oct 10, 2025
5 checks passed
@mcculls mcculls deleted the mcculls/matcher-cleanup branch October 10, 2025 11:36
@github-actions github-actions bot added this to the 0.0.2 milestone Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants