Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4881179
Votes 0
Synopsis Rule for semantics of ?: in the presence of generics and generic class Class
Category java:compiler
Reported Against 1.5 , 1.4.2 , tiger
Release Fixed 1.5(tiger-b28)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 4952864 , 4952888 , 5047104
Submit Date 19-JUN-2003
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  xxxxx .  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.
Work Around
N/A
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)

 xxxxx@xxxxx  2003-06-19
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang