covariant returns for CharBuffer.subSequence

Ulf Zibis Ulf.Zibis at gmx.de
Sat Aug 2 09:54:31 UTC 2008


Am 01.08.2008 10:39, Alan Bateman schrieb:
> In particular the Buffer flip/etc. methods come up quite often as the 
> more specific return type would facilitate better method invocation 
> chaining.

Some time ago I've discussed this with Neal Gafter. My conclusion is, 
that those problems could be solved by a "this" return type.

Example:

public abstract class Buffer {

   public final this flip() {
   ...
   return this;
   }

}

-Ulf





More information about the core-libs-dev mailing list