JDK-8279866 : Release Note: Indy String Concat Changes Order of Operations
  • Type: Sub-task
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 17.0.14-oracle,19
  • Priority: P3
  • Status: Resolved
  • Resolution: Delivered
  • Submitted: 2022-01-11
  • Updated: 2024-10-28
  • Resolved: 2022-05-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 19
19Resolved
Description
String concatenation has been changed to evaluate each argument and eagerly convert it to a string, in left-to-right order. This fixes a bug in the invokedynamic-based string concatentation strategies introduced in [JEP 280](http://openjdk.java.net/jeps/280).

For example, the following now prints `"foofoobar"`, not `"foobarfoobar"`:

```
    StringBuilder builder = new StringBuilder("foo");
    System.err.println("" + builder + builder.append("bar"));
```