Implicit 'this' return for void methods

Jochen Theodorou blackdrag at gmx.org
Thu Mar 27 21:02:56 UTC 2014


Am 27.03.2014 21:52, schrieb Eirik Lygre:
[...]
> The JavaBean specification, with it's "void setSomething()" functions
> are fundamental to so many things Java that they will never go away
> (good thing, too!).The suggested language change builds on top of that,
> is beneficial to a large body of existing code and does not invalidate
> any existing practices.
>
> It is, I think, a great example of bang for the buck -- low cost, high
> return. No changes needed in the VM; everything can be done by the
> compiler. Almost too sweet.

Hmm... isn't it a problem if I change "void setSomething()" to "MyClass 
setSomething()". In example, is that still a valid setter in terms of 
the JavaBean Spec? I might be wrong, but afaik there are bean based 
tools out there, not recognizing setters like that. At least I remember 
having such cases in the past. If I am right, then there is quite a 
chance of invalidating working code.

> I should have paid more attention to the dragon book, so that I could
> have taken a shot at the compiler myself :-/

I think you won't need it for that kind of change. You don't change the 
grammar, or any first level rules. You would change the internal AST, or 
even the bytecode generation part for this. You need to know javac 
internals instead... bad enough imho

bye blackdrag

-- 
Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
blog: http://blackdragsview.blogspot.com/
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit http://groovy-lang.org




More information about the core-libs-dev mailing list