RFR: 8065554: MatchResult should provide values of named-capturing groups [v5]

Stuart Marks smarks at openjdk.org
Fri Sep 2 17:40:42 UTC 2022


On Wed, 31 Aug 2022 13:26:32 GMT, Raffaello Giulietti <duke at openjdk.org> wrote:

>> Add support for named groups to java.util.regex.MatchResult
>
> Raffaello Giulietti has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8065554: MatchResult should provide values of named-capturing groups

src/java.base/share/classes/java/util/regex/MatchResult.java line 347:

> 345:      *
> 346:      * @throws UnsupportedOperationException
> 347:      *          The default implementation of this method always throws

Similar comment here as above, though it has nothing to do with named groups. The `@throws` clause should say it throws UOE if "the implementation cannot report whether or not it has a match" or some such. This is a bit odd, but the specification needs to be permissive enough so that it doesn't invalidate existing implementations outside the JDK.

As before, the "always throws" should be moved to `@implSpec`.

-------------

PR: https://git.openjdk.org/jdk/pull/10000


More information about the core-libs-dev mailing list