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

Raffaello Giulietti duke at openjdk.org
Fri Sep 2 18:38:06 UTC 2022


On Fri, 2 Sep 2022 17:33:21 GMT, Stuart Marks <smarks at openjdk.org> wrote:

>> 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 319:
> 
>> 317:      *
>> 318:      * @throws UnsupportedOperationException
>> 319:      *          The default implementation of this method always throws
> 
> The `@throws` clause needs to state a general contract over all implementations, so it should say something like, "@throws UOE if the implementation does not support named groups". Then, the specification for the default implementation always throwing UOE should be moved to `@implSpec`.

Done

> 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`.

Done

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

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


More information about the core-libs-dev mailing list