JLS tweaks
David M. Lloyd
david.lloyd at redhat.com
Fri Mar 14 13:50:37 UTC 2014
On 03/13/2014 05:00 PM, Archie Cobbs wrote:
> On Thu, Mar 13, 2014 at 5:21 AM, Peter Levart <peter.levart at gmail.com
> <mailto:peter.levart at gmail.com>> wrote:
>
> On 03/13/2014 11:08 AM, Peter Levart wrote:
>
> I don't see this as any more complex or unsafe as the rules for
> final fields. But I don't know if it is compatible with JVM rules.
>
>
> Does JVM have any rules for final instance fields regarding their
> definitive assignment at all non-exceptional exit paths of the
> constructor?
>
>
> My understanding is that the JVM doesn't care how many times you assign
> a final field in a constructor, it only cares that you don't try to
> assign it from within a non-constructor method.
[...]
> Note also that the JVM spec specifically allows a constructor to assign
> final fields before invoking super()/this().
I think you're mistaken on both of these points... can you quote a
section of the JLS that says this?
--
- DML
More information about the compiler-dev
mailing list