Re: Idiom for forcing class loading?
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
---910079544-346501521-1258664619=:3772
Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8BIT
On Wed, 18 Nov 2009, Alessio Stalla wrote:
On 18 Nov, 20:06, Tom Anderson <t...@urchin.earth.li> wrote:
What's really happening is more like this:
class FooMangler implements Mangler {
? ? ? ? static {
? ? ? ? ? ? ? ? ManglerRegistry.register("foo", FooMangler.class);
? ? ? ? }
}
If you have control on the source code of the mangler, I would do like
this:
class FooMangler implements Mangler {
public static void autoregister() {}
...
}
and to initialize it, FooMangler.autoregister();
We have indeed done it like that in similar situations. I can't remember
why we didn't do it like that here - i think someone didn't like the idea
of having a method which 'did nothing'. I'll mention this to my colleagues
when we next pass by this bit of code.
tom
--
Safety Not Guaranteed
---910079544-346501521-1258664619=:3772--