JDK-4881179 : Rule for semantics of ?: in the presence of generics and generic class Class
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.4.2,5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_8,windows_xp
  • CPU: generic,x86
  • Submitted: 2003-06-19
  • Updated: 2003-11-11
  • Resolved: 2003-11-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b28Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
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
14-06-2004

PUBLIC COMMENTS ...
10-06-2004

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
19-06-2003