Another approach could be to implicitly allow method invocation chaining for all void methods. This would save the return statement, and its superfluous byte code.

... but I think, you know all this:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6373386
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6479372

-Ulf


Am 01.08.2008 22:38, 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



Reply via email to