covariant returns for CharBuffer.subSequence

Ulf Zibis Ulf.Zibis at
Sat Aug 2 10:00:40 UTC 2008

What about to distinguish chainable from unchainable methods by dropping 
the 'void' keyword for chainables? So there would be no need to think 
about a new type, which is not generally usable e.g. for parameters.
OK, there would be some chance for confusion with constructors, but 
method names normally shouldn't start with a capital letter, but 
constructors should.


Am 02.08.2008 11:54, Ulf Zibis schrieb:
> 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