Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8264671

Update Pattern spec to provide details of character class syntax and behavior

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:

      Description

      In JDK 9, JDK-6609854 made a significant change to the behavior of negation and nesting of character classes. This change was not documented anywhere, because some of the more obscure behaviors of character classes are not documented at all. These need to be specified.

      This message from Xueming Shen (who implemented the earlier change) describes the change, some rationale, and most importantly for this bug, a some hints at what should be in the specification of these features of character classes:

      http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-June/006957.html

      The various operators whose behaviors need to be specified in combination are:

      (1) Negation ^ (only at the beginning of the [...])
      (2) Intersection &&
      (3) Range -
      (4) nested class []
      (5) Union (empty string, that is, two elements placed adjacent)

      Xueming's email has a statement about the precedence of these operators, but I don't think it's correct. Of course, the eventual specification should be correct.

      This is mostly about specifying the existing behaviors of regex character classes, after the JDK-6609854 change. I don't expect there to be any code or behavior changes as a result of this specification update. However, some bugs might be flushed out by closer analysis, and some additional tests might be warranted. That work could be handled by separate bugs.

        Attachments

          Activity

            People

            Assignee:
            igraves Ian Graves
            Reporter:
            smarks Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: