JDK-4191252 : The Java language should allow covariant method return types
  • Type: Enhancement
  • Component: specification
  • Sub-Component: language
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1998-11-19
  • Updated: 2006-07-13
  • Resolved: 2006-07-13
Related Reports
Duplicate :  
Description
Name: gb36485			Date: 11/18/98


The Java virtual machine, for reasons of binary compatibility, already
allows a method to be overridden by a method of the same signature
but with a return type which is a subtype of the method it overrides.

For greater type safety, the Java language should remove the restriction
that overriding methods must have the same return type as the methods
they override.

I will submit a more detailed proposal, including changes to the JLS, in
the future.

Note that this is a 100% compatible change.
(Review ID: 42168)
======================================================================

Comments
EVALUATION Duplicate of 4144488 which was added to Tiger (jdk5.0) under JSR-14: http://jcp.org/en/jsr/detail?id=14 A complete description of this language feature may be found in the Java Language Specification, Third Edition. A reasonable place for a reader to being might be section 8.1.2 "Generic Classes and Type Parameters". http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1.2
2006-07-13

EVALUATION Good idea. Dealt with as part of the GJ proposal. gilad.bracha@eng 1998-12-01
1998-12-01