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

Replace usage of StringBuffer with StringBuilder in Swing

XMLWordPrintable

    • b118
    • x86
    • solaris_10
    • Not verified

      A DESCRIPTION OF THE REQUEST :
      There are several places in javax.swing.text where StringBuffer could be replaced with StringBuilder. Files that use StringBuffer and are candidates for change:
      DefaultCaret
      DefaultStyledDocument
      InternationalFormatter
      JTextComponent
      MaskFormatter
      NumberFormatter
      PlainDocument
      TabSet


      JUSTIFICATION :
      this will increase performance as acquiring the lock for the associated Object will no longer happen with each method invocation.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      useless locking removed.
      ACTUAL -
      useless locking happening

      ---------- BEGIN SOURCE ----------
      Read the source of the noted files, see usage of StringBuffer within methods that could be replaced with StringBuilder.
      ---------- END SOURCE ----------

      While Swing text stands to benefit the most, might as well do ALL of Swing.

            rupashka Pavel Porvatov (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: