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

The java.lang.String.split method description does not match its actual behavior

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 15
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      ADDITIONAL SYSTEM INFORMATION :
      This request does not affect any OS, but affect JDK since 1.7.
                         /* fastpath if the regex is a
       2314 (1)one-char String and this character is not one of the
       2315 RegEx's meta characters ".$|()[{^?*+\\", or
       2316 (2)two-char String and the first char is the backslash and
       2317 the second is not the ascii digit or ascii letter.
       2318 */

      A DESCRIPTION OF THE PROBLEM :
      The split function body comment says the regex string passed into this function may not be executed as a regular expression in two cases if the length is one or two. (see information below)
      But this information is not documented since JDK 1.7. Without it, developers may misunderstand they are using regexes for splitting while actually the code does not run as a regex matching.


        Attachments

          Activity

            People

            • Assignee:
              smarks Stuart Marks
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: