-
Enhancement
-
Resolution: Fixed
-
P4
-
6
-
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.
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.
- relates to
-
JDK-4945824 Should consider using StringBuilder instead of String/StringBuffer in AWT
- Closed