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

12.5: Clarify that non-constant string + always returns a new String

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8u40
    • Component/s: specification
    • Labels:

      Description

      JLS 12.5 has always said: "Execution of a string concatenation operator (§15.18.1) that is not part of a constant expression (§15.28) sometimes creates a new String object to represent the result."

      However, the "sometimes" appears wrong; 15.18.1 requires that a new String is always created for a + that isn't a constant expression. See http://mail.openjdk.java.net/pipermail/compiler-dev/2014-January/008451.html

        Attachments

          Activity

            People

            Assignee:
            abuckley Alex Buckley
            Reporter:
            abuckley Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: