|
Quick Lists
|
|
Bug ID:
|
6379062
|
|
Votes
|
0
|
|
Synopsis
|
(cl) ClassLoader.loadLibrary0 invokes dubious Boolean constructor
|
|
Category
|
java:classes_lang
|
|
Reported Against
|
|
|
Release Fixed
|
7(b25)
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
6600143
|
|
Submit Date
|
31-JAN-2006
|
|
Description
|
Creating new instances of java.lang.Boolean wastes memory, since Boolean objects are immutable and there are only two useful values of this type. Use the Boolean.valueOf() method to create Boolean objects instead.
$ pwd
/local-copy/1.6.0-rc-b69_src/j2se/src/share/classes/java/lang
$ tail +1685 ClassLoader.java | head -7
private static boolean loadLibrary0(Class fromClass, final File file) {
Boolean exists = (Boolean)
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return new Boolean(file.exists()); // <---- here
}
});
Posted Date : 2006-01-31 12:13:06.0
|
|
Work Around
|
N/A
|
|
Evaluation
|
We should implement the suggested fix.
Posted Date : 2007-10-03 22:33:56.0
We've decided to go with the apparently most efficient variant
boolean exists = AccessController.doPrivileged(
new PrivilegedAction<Object>() {
public Object run() {
return file.exists() ? Boolean.TRUE : null;
}})
!= null;
Posted Date : 2007-11-21 22:22:27.0
NOTE: The 6379062 fix went in to JDK 7 at the same time as the fix for 6600143 under changeset 20:03fddaf59499. There is no separate changeset for 6379062.
Posted Date : 2008-03-19 03:24:00.0
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |