Lifetime of a local reference
Alan Bawden
alan at csail.mit.edu
Fri Mar 1 17:27:39 EST 2019
ram at zedat.fu-berlin.de (Stefan Ram) writes:
> Alan Bawden <alan at csail.mit.edu> writes:
> >The Java compiler has no way to know whether a variable references an
> >object with a finalize() method that has side effects
>
> java.lang.Object#finalize() is deprecated since Java 9.
And we are advised to use a "Cleaner" or a "PhantomReference" instead. So
there are still non-deprecated mechanisms in Java 11 you can use to run
cleanup code when an object becomes unreachable. And the language I quoted
from the Java 8 spec is still there in the Java 11 spec. So the situation
is unchanged with respect to the point I was making.
--
Alan Bawden
More information about the Python-list
mailing list