United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-5004321 : Object.getClass() should return erased class type

Details
Type:
Bug
Submit Date:
2004-02-26
Status:
Resolved
Updated Date:
2004-04-16
Project Name:
JDK
Resolved Date:
2004-04-16
Component:
tools
OS:
solaris_8
Sub-Component:
javac
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:
5.0 (b48)

Related Reports
Relates:

Sub Tasks

Description
See http://forum.java.sun.com/thread.jsp?forum=316&thread=496028

The following program fragment fails to compile

    void f(List<Integer> li, List<String> ls) {
        if (li.getClass() == ls.getClass())
	    ;
    }

because the intersection of Class<List<Integer>> and Class<List<String>> is
empty.

                                    

Comments
EVALUATION

To address this we should relax the rules for getClass, so that on
an expression e of static type X, e.getClass() returns a value of type

    Class<? extends erasure(X)>

###@###.### 2004-02-26

Awaiting CCC approval.

###@###.### 2004-02-27
###@###.### 2004-03-09
                                     
2004-02-26
PUBLIC COMMENTS

...
                                     
2004-06-10
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger-beta2

FIXED IN:
tiger-beta2

INTEGRATED IN:
tiger-b48
tiger-beta2


                                     
2004-06-14



Hardware and Software, Engineered to Work Together