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

String concatenation optimization reverted to old way

    Details

    • Subcomponent:
    • Introduced In Build:
      1.3
    • Introduced In Version:
    • CPU:
      x86
    • OS:
      windows_nt

      Description

      Name: rlT66838 Date: 05/17/2000


      I was looking at bytecode generated by javac and noticed a curious difference
      between jdk1.2.2 and jdk1.3 final

      javac 1.2.2 had a revised code generation for concatenation such that

        aString = string1 + string2;

      generates

        aString = new StringBuffer(String.valueOf(string1)).append(string2);

      But, javac 1.3 generates

        aString = new StringBuffer().append(string1).append(string2);

      The 1.3 code generation is the same as that generated by older javac versions
      (sometime prior to 1.2.2). Is that intentional? Either the 1.3 writers failed
      to incorporate a late improvement from the 1.2.2 branch, or someone decided
      that the 1.2.2 method wasn't such a good idea.

      I'm just calling this to your attention in case it's an oversight.
      (Review ID: 105010)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vromero Vicente Arturo Romero Zaldivar
                Reporter:
                rlewis Roger Lewis (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: