United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4881179 : Rule for semantics of ?: in the presence of generics and generic class Class

Details
Type:
Bug
Submit Date:
2003-06-19
Status:
Resolved
Updated Date:
2003-11-11
Project Name:
JDK
Resolved Date:
2003-11-11
Component:
tools
OS:
solaris_8,windows_xp
Sub-Component:
javac
CPU:
generic,x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.2,5.0
Fixed Versions:
5.0 (b28)

Related Reports
Duplicate:
Duplicate:
Duplicate:

Sub Tasks

Description
Existing code such as

	Class a = boolean ? A.class : B.class;

should compile without error, in spite of the fact that (with generics
enabled) neither A.class nor B.class is a subtype of the other.  With
wildcards, the result type should be

	Class<?>

Or, if A is a base class of B,

	Class<? extends A>

This is a backward compatibility issue.

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger
tiger-beta

FIXED IN:
tiger-beta

INTEGRATED IN:
tiger-b28
tiger-beta


                                     
2004-06-14
PUBLIC COMMENTS

...
                                     
2004-06-10
EVALUATION

Indeed, class Class can only be generified with a version of the compiler
that supports wildcards.

The proposed semantics of type inference of ?: for object types is the
same as for a call to a method with the signature

    <T> T f(boolean, T, T)

(Without wildcards, we would have to infer Object for T, which breaks
compatibility)

###@###.### 2003-06-19
                                     
2003-06-19



Hardware and Software, Engineered to Work Together