Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Won't Fix
-
None
-
None
-
None
-
None
Description
Starting with Java 5, subclasses with method overrides can declare covariant return types. In general, I believe that we want to do this, as it provides stronger type guarantees with not a lot of extra cost.
Example:
public interface SortedKeyValueIterator { SortedKeyValueIterator deepCopy(IteratorEnvironment env); } public interface InterruptibleIterator extends SortedKeyValueIterator { @Override InterruptibleIterator deepCopy(IteratorEnvironment env); }
I believe this change will be fully backwards compatible with the existing APIs.