|
Quick Lists
|
|
Bug ID:
|
6613529
|
|
Votes
|
0
|
|
Synopsis
|
Avoid duplicate object creation within JDK packages
|
|
Category
|
java:classes_awt
|
|
Reported Against
|
|
|
Release Fixed
|
7(b27)
|
|
State
|
10-Fix Delivered,
request for enhancement
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
|
|
Submit Date
|
05-OCT-2007
|
|
Description
|
There are some places we use something like:
new String("xyz")
new Boolean(value)
new Integer(value)
all that causes to create duplicate objects. Refer to Effective Java book [Article 4]. There are a lot of such places in Swing and AWT code. Below are only three of them:
src/windows/classes/sun/awt/windows/WInputMethod.java
javax/swing/plaf/metal/MetalLookAndFeel.java:462: Integer zero = new Integer(0);
com/sun/java/swing/plaf/gtk/GTKStyle.java:854: value = new Integer(16 + 2 * focusLineWidth);
STEPS TO FOLLOW TO REPRODUCE:
Grep for a particular pattern.
Posted Date : 2007-10-05 15:07:59.0
|
|
Work Around
|
N/A
|
|
Evaluation
|
Should avoid resundant object creation when possible.
Posted Date : 2007-10-17 08:36:11.0
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |