Re: Thread.finalize (II)

Date view Thread view Subject view Author view

From: Alexandre Oliva (oliva@dcc.unicamp.br)
Date: Sun Dec 13 1998 - 15:04:12 EST


On Dec 13, 1998, Godmar Back <gback@cs.utah.edu> wrote:

> With this solution, it would possible for me to create
> a ThreadFinalizer object (by placing my application in java.lang.
> to get package access), then drop it and have the thread garbage
> wrongly finalized.

Yep, and your application would probably crash shortly thereafter; not
very useful :-)

Anyway, I don't think you should be able to place your application in
java.lang. In Java2, for example, the concept of Package was
explicitly brought into the language (java.lang.Package), and, AFAIK,
a ClassLoader shouldn't let one package define classes in the domain
of another package.

> If an anonymous class is used, the same holds true, but if Sun
> even comes up with a solution that makes private anonymous inner
> class truely private (i.e., with the need for package-accessible
> constructor), we would be able to profit from it by having used
> anonymous inner classes in the first place, wouldn't we?

That sounds correct, but I doubt any such change will introduce
backward incompatibility.

> Couldn't you just stick with your original idea for which you've
> already been credited in the makefile as a clever solution?

If finalize0 is given package access, to avoid the creation of the
accessor method and its additional invocation, that would be fine by
me. But I'd really prefer to avoid the two invocations, i.e., running
finelize0 directly.

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:14 EDT