Skip to content

Java 20 breaks LexicalsTest.testSeparator #435

Closed

Description

@jcflack

Until a solution for that, well, use Java 19 or earlier.

Activity

  1. jcflack commented on May 30, 2023

    @jcflack
    ContributorAuthor

    Also breaks the DDRProcessor. Looks like they've changed what regular expressions mean.

  2. added a commit that references this issue on May 30, 2023
  3. jcflack commented on Jun 5, 2023

    @jcflack
    ContributorAuthor

    Submitted at bugreport.java.com as JI-9075361 published as JDK-8309515:

    In addressing issue 8065554 (MatchResult should provide values of named-capturing groups), commit openjdk/jdk@ce85cac added a namedGroups field in Matcher to cache the map from parentPattern.namedGroups().

    The map is lazily cached, only when the field is null and namedGroups() is called (which may be indirectly through a call of start(String), end(String), or group(String). The same cached value will then continue to be returned even if Matcher.usePattern is later called and the new Pattern has different named groups, or no named groups, or the same named groups mapped to different integers. Therefore, symptoms can include seeing the wrong results when retrieving by named groups, or spurious IllegalArgumentExceptions for groups that the new pattern provides, or exceptions not thrown for groups that the new pattern doesn't provide, or exceptions for an invalid group index when calling a method that takes a group name.

    Could be fixed by eliminating the local copy and simply having Matcher.namedGroups() call parentPattern.namedGroups() unconditionally, or by having Matcher.usePattern simply null the field, so the correct map will be lazily cached when next needed.

  4. jcflack commented on Jun 13, 2023

    @jcflack
    ContributorAuthor

    Resolved in 1.6.5 by detecting when affected by this bug and throwing an exception. The message advises to use either a version of Java earlier than 20, or a version recent enough to have JDK-8309515 fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions