JDK-6455353 : Replace usage of Stack with ArrayDeque in Swing, when appropiate
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2006-08-01
  • Updated: 2022-09-06
  • Resolved: 2022-09-06
Related Reports
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0-rc"

A DESCRIPTION OF THE PROBLEM :
Stack should be replaced with ArrayDeque where it appropiate.  It offers more flexibility in the interface and its methods are unsynchronized which should provied improved performance.  Ive identified these classes as potential users of Stack:
/javax/swing/ActionMap.java
/javax/swing/InputMap.java
/javax/swing/JComponent.java
/javax/swing/JEditorPane.java
/javax/swing/JMenu.java
/javax/swing/JRootPane.java
/javax/swing/JTree.java
/javax/swing/KeyboardManager.java
/javax/swing/MenuSelectionManager.java
/javax/swing/SwingUtilities.java
/javax/swing/SystemEventQueueUtilities.java
/javax/swing/UIDefaults.java
/javax/swing/filechooser/FileSystemView.java
/javax/swing/plaf/basic/BasicLookAndFeel.java
/javax/swing/plaf/basic/BasicMenuItemUI.java
/javax/swing/text/DefaultCaret.java
/javax/swing/text/DefaultStyledDocument.java
/javax/swing/text/ElementIterator.java
/javax/swing/text/StyleContext.java
/javax/swing/text/html/CSS.java
/javax/swing/text/html/CSSParser.java
/javax/swing/text/html/FrameView.java
/javax/swing/text/html/HTMLDocument.java
/javax/swing/text/html/HTMLWriter.java
/javax/swing/text/html/StyleSheet.java
/javax/swing/text/html/parser/Parser.java
/javax/swing/text/html/parser/TagStack.java
/javax/swing/text/rtf/RTFGenerator.java
/javax/swing/tree/DefaultMutableTreeNode.java
/javax/swing/tree/FixedHeightLayoutCache.java
/javax/swing/tree/VariableHeightLayoutCache.java

they should be audited and have their Stacks replaced with ArrayDeques.

REGRESSION.  Last worked in version mustang

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
read the source, their using the Stack

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
ArrayDeques being used.
ACTUAL -
Stacks everywhere!

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
read the source, their there.
---------- END SOURCE ----------

Comments
EVALUATION See also 6454581, which is about using HashMap instead of Hashtable. See also 6454582, which is about using ArrayList instead of Vector. See also 4304287, which is about using Collections in public API.
01-08-2006