8217496: Matcher.group() can return null after usePattern

Reviewed-by: smarks
This commit is contained in:
Ian Graves 2023-03-07 17:20:04 +00:00
parent 45a616a891
commit ac3ab5b007

View file

@ -607,7 +607,9 @@ public final class Matcher implements MatchResult {
* successfully matches the empty string in the input. </p>
*
* @return The (possibly empty) subsequence matched by the previous match,
* in string form
* in string form or {@code null} if a matcher with a previous
* match has changed its {@link java.util.regex.Pattern},
* but no new match has yet been attempted
*
* @throws IllegalStateException
* If no match has yet been attempted,
@ -643,7 +645,9 @@ public final class Matcher implements MatchResult {
*
* @return The (possibly empty) subsequence captured by the group
* during the previous match, or {@code null} if the group
* failed to match part of the input
* failed to match part of the input or if the matcher's
* {@link java.util.regex.Pattern} has changed after a
* successful match, but a new match has not been attempted
*
* @throws IllegalStateException
* If no match has yet been attempted,