On Tue, 4 Nov 2025 11:56:52 GMT, Ioi Lam <[email protected]> wrote: >> In the previous fix (https://github.com/openjdk/jdk/pull/28035), I added >> `OutputAnalyzer::match(String regexp)`, but it uses `String.matches()` which >> has different semantics than the existing "match" functions such as >> `OutputAnalyzer::shouldMatch()`. >> >> `String.matches()` is a poor choice for matching the stdout/stderr in >> `OutputAnalyzer`: >> >> - It requires a full match, so you need to use >> `haystackString.matches(".*needle.*")` >> - But `.*` doesn't match across newlines, so it's basically useless for most >> program output. >> >> That's why the pattern in the previous fix in >> AccessZeroNKlassHitsProtectionZone.java >> (https://github.com/openjdk/jdk/pull/28035) doesn't work: >> >> https://github.com/openjdk/jdk/blame/e4aed95cac343f1339b9bc87721561bdc4c2f5ad/test/hotspot/jtreg/runtime/ErrorHandling/AccessZeroNKlassHitsProtectionZone.java#L146 >> >> I fixed this by re-working `OutputAnalyzer::match()`, etc, to do the same >> thing as `OutputAnalyzer::shouldMatch()`. I also refactored the code to >> consolidate most of the regexp handling code to the two `matchesHelper()` >> methods. > > Ioi Lam has updated the pull request incrementally with one additional commit > since the last revision: > > Use String... as suggested by @stefank
OK. So, this misleading naming is already present in the OutputAnalyzer and this patch doesn't make things worse than what it already is. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28077#issuecomment-3491341099
