On Tue, 4 Nov 2025 13:44:50 GMT, Stefan Karlsson <[email protected]> wrote:
> You need to make sure that the code has sensible names throughout the
> library, not only the functions you introduce. There are still functions that
> uses "find" that have names that including the word "matches":
>
> ```
> public boolean stdoutMatches(String regexp) {
> return findPattern(regexp, getStdout());
> }
> ```
We have existing APIs like `contains()` vs `shouldContain()`. If I introduce a
new API `finds()`, that will be inconsistent with `shouldMatch()`.
There are hundreds of `shouldMatch()` in existing tests, and honestly "matching
a regexp" is more intuitive than "finding a substring that matches the regexp",
so I don't see any reason of changing that.
So, we will inevitably have an API with the name `match` that eventually calls
"...matcher().find()". It's still using a "matcher" to decides whether
something "matches". I don't see a problem with doing this, especially when
it's only used in the implementation.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28077#issuecomment-3486861935