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

Stuart Marks smarks at openjdk.org
Fri Aug 26 01:22:02 UTC 2022


On Wed, 24 Aug 2022 18:22:42 GMT, Raffaello Giulietti <duke at openjdk.org> wrote:

>> In principle, yes. In practice, I see that `namedGroups` doesn't have an `@throws UnsupportedOperationException` but has an `@implSpec` that says that the default implementation throws `UnsupportedOperationException`. This seems strange to me - maybe @stuart-marks or @jddarcy can comment.
>> 
>> What I was hinting at here however is that we might want to extend the `@implSpec` of the new methods to note that these method will throw `UnsuportedOperationException` if `namedGroups` is not implemented (like the `@implSpec` of `namedGroups` does).
>
> Ah, I see.
> So what you mean is not adding another @throws clause but to either improve @implNote or, better, to add @implSpec.

I left some inline comments on the `@implSpec`. But I do think that these methods require `@throws UnsupportedOperationException` for the cases where they don't support named groups.

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

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


More information about the core-libs-dev mailing list