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

Stuart Marks smarks at openjdk.org
Fri Aug 26 01:17:15 UTC 2022


On Thu, 25 Aug 2022 09:24:20 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

test/jdk/java/util/regex/NamedGroupsTests.java line 115:

> 113:                             r.group("noSuchGroup");
> 114:                         } catch (IllegalArgumentException e) {  // swallowing intended
> 115:                         }

If MatchResult is behind correctly, the call to `r.start("noSuchGroup")` will always throw an exception and the subsequent calls to `r.end` and `r.group` will never be executed. This potentially will miss testing of those methods.

test/jdk/java/util/regex/NamedGroupsTests.java line 128:

> 126:                 result.group("noSuchGroup");
> 127:             } catch (IllegalArgumentException e) {  // swallowing intended
> 128:             }

Similar issue here as above.

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

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


More information about the core-libs-dev mailing list