United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4990346 : wrapper static factories fail to cache as required

Details
Type:
Bug
Submit Date:
2004-02-06
Status:
Resolved
Updated Date:
2004-03-04
Project Name:
JDK
Resolved Date:
2004-03-04
Component:
core-libs
OS:
solaris_8,windows_xp
Sub-Component:
java.lang
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:
5.0 (b42)

Related Reports
Duplicate:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

Description
The latest boxing spec filed under CCC 4989021 requires an implementation
to cache boxed values in the range -128 to 127.  The following test case
for this property fails, showing that we don't cache.

class CacheBox {
    public static void main(String[] args) {
        Integer i1 = 12;
        Integer i2 = 12;
        if (i1 != i2) throw new Error();
    }
}

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger-beta2

FIXED IN:
tiger-beta2

INTEGRATED IN:
tiger-b42
tiger-beta2


                                     
2004-06-14
SUGGESTED FIX

Use a static nested class with a static array to implement the cache.  The cache is created lazily but populated eagerly.

###@###.### 2004-03-01
                                     
2004-03-01
EVALUATION

Yes, if the returned values have to be == a cache will be necessary.

###@###.### 2004-02-09
                                     
2004-02-09



Hardware and Software, Engineered to Work Together