JDK-8034068 : Label.toString performance improvement
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-02-10
  • Updated: 2014-07-29
  • Resolved: 2014-02-17
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 8 JDK 9
8u20Fixed 9 b06Fixed
Description
Current version of toString/paramString in the Label is not effective.
Code:
=====
        String str = ",align=";
        switch (alignment) {
          case LEFT:   str += "left"; break;
          case CENTER: str += "center"; break;
          case RIGHT:  str += "right"; break;
        }
        return super.paramString() + str + ",text=" + text;
=====
generated to something like this:
        String s = ",align=";
        switch(alignment) {
          case 0: s = (new StringBuilder()).append(s).append("left").toString(); break;
          case 1: s = (new StringBuilder()).append(s).append("center").toString(); break;
          case 2: s = (new StringBuilder()).append(s).append("right").toString(); break;
        }
        return (new StringBuilder()).append(super.paramString()).append(s).append(",text=").append(text).toString();