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

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

XMLWordPrintable

      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

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

              Created:
              Updated:
              Resolved: