On Wed, 03 Oct 2007 17:09:29 +0200, Charles Oliver Nutter <[EMAIL PROTECTED]> wrote:
> > Attila Szegedi wrote: > > I think the counterpoint to that requirement would be "I don't care". > I'm using <clinit> in my compiled classes to initialize things like Ruby > string objects, Ruby stack trace positioning information and so on. I > really would be happy as a clam if <clinit> ran again...and of course > the assertion that <clinit> is only going to run once is impossible to > guarantee anyway, since people in our case end up loading the same > classes in separate classloaders anyway. Those end up being two separate classes then -- you'd get a ClassCastException if you tried to cast an instance of one into the other. Class identity is always class loader scoped, so you still get one guaranteed <clinit> per class, 'cause as far as JVM is concerned, loading the same bytecode in two class loaders results in two different classes. > Perhaps people are doing things > with side effects in <clinit>...that's their problem, not mine. It seems > quite unfortunate to have an artificial limitation on class GC to > support a few bad designs. It's time to Free the Class! > This actually sounds like it'd make sense to add a new class annotation in next Java release, i.e. @Disposable. JVM would not create strong references from the class with this annotation to the class loader. (It might actually want to create a soft reference, though, to minimize the number of reloads.) I'm not sure whether this'd could actually fly -- I myself don't see why not, but maybe some JVM folks with more insight on this list could tell us if there'd be some dire consequence to having this feature? Attila. -- home: http://www.szegedi.org weblog: http://constc.blogspot.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---
