markmahieu at googlemail.com
Sat Mar 14 16:39:22 PDT 2009
On 14 Mar 2009, at 23:20, Florian Weimer wrote:
> The "!= null" part is there to make it possible to signal to the
> cleanup handler that the object has changed ownership. Assignment
> to the variable does not trigger cleanup, cleanup only happens at
> scope exit.
I toyed with this idea a while back when I was messing around with
the predecessor to Josh Bloch's current ARM proposal (presumably
you've seen that?). I didn't think it pulled its weight to be
honest, in the context of ARM anyway.
> Annotation-controlled overlading is used instead of an interface
> because the existing cleanup routines have a myriad of different
> names and declare different checked exceptions, too. If there are
> multiple @Cleanup methods for a type, a warning should be issued
> if this happens through inheritance (old code which needs to be
> ported), or an error if there are multiple such methods declared
> in the same type (erroneous new code). In both cases, if such a
> type is used in a transient local variable declaration, the
> declaration is rejected.
For better or worse, using annotations for these purposes is off limits.
More information about the coin-dev