JLS tweaks
David M. Lloyd
david.lloyd at redhat.com
Mon Mar 3 10:55:53 PST 2014
On 03/03/2014 11:45 AM, Brian Goetz wrote:
> So, none of these are really "tweaks". And of these, only #1 is
> actually small. Some very quick comments.
>
>> *Idea #1: Allow final index variable in Iterable loops*
> OK, this is a pretty tiny change. Low cost, low risk -- but also low
> reward.
AFAICT this is already allowed and works as described.
>> *Idea #2: Allow non-this code prior to super()/this() call in
>> constructors*
> This is well-traveled ground; this request has come up, and been shot
> down, many times. If anything, the language spec is already too loose
> here, allowing too many unsafe operations (e.g., calling virtual methods
> from constructors, allowing constructor to publish 'this', etc) and this
> would make this problem dramatically worse.
It's interesting that in core-libs-dev (iirc) we were discussing the
exact opposite idea, in the context of serialization improvement the
possibility of creating a new class or mode of constructor which
explicitly is locked to the current class (i.e. no this/super allowed at
all).
--
- DML
More information about the compiler-dev
mailing list