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

(spec str) clarify specs of String.replace, replaceFirst, replaceAll

    XMLWordPrintable

    Details

      Description

      A DESCRIPTION OF THE PROBLEM :
      replace(CharSequence target, CharSequence replacement)
      "Replaces each substring of this string" is misleading, particularly for beginners.
      replaceAll and replaceFirst have the same problem.
      Please be consistent.

      A similar bug report was answered with "It's a matter of interpretation."
      I don't want to INTERPRET Javadoc. It isn't an English essay in school. It should be clear, concise and NOT open to interpretation.
      Thanks! :-)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The description for
      replace(char oldChar, char newChar)
      is better:
      "_RETURNS_ a string resulting from replacing..."
      ACTUAL -
      "Replaces each substring of this string"

      URL OF FAULTY DOCUMENTATION :
      https://docs.oracle.com/javase/8/docs/api/java/lang/String.html

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: