[concurrency-interest] Question about "happens-before"
tackline at tackline.plus.com
Fri May 19 10:57:53 EDT 2006
Pete Soper wrote:
> This seemed quite clear the first time. More fundamentally, if the
> constructor never completes, the finalizer's running is impossible, right?
JLS 3 states that the finaliser may (because it never must) run if the
Object constructor exited normally. 1.6 complies with this (apparently
even if instrumentation rewrites the Object constructor).
I believe earlier editions of the JLS are silent on this. 1.5 (and I
presumably earlier versions) will call the finaliser on any object that
has been allocated. Possibly not even calling the derived most
constructor. IIRC, javac produced byte code does the new, dups the
uninitialised reference, evaluates the arguments, then calls the
<init>(...)V, so even if the arguments are not fully evaluated the
finaliser is called.
More information about the Concurrency-interest