On Mon, Sep 1, 2014 at 8:54 PM, Dawid Weiss <[email protected]>
wrote:

> To be honest you shouldn't have any static initializers at all,
> including final fields (unless they're really immutable, simple data
> types). The reason for this is that static initializers (including
> those for final field assignments) are invoked when the class is
> initialized and this may be happening outside of the scope of the test
> runner. @BeforeClass or class rules are the way to "properly"
> initialize before-test-suite things.
>

I was trying to see if I hack something to see if this can be checked and
realized there's a StaticFieldsInvariantRule set up in LuceneTestCase which
was checking for memory leaks on exactly such fields. So I am guessing we
are still using them a bit :) (and a quick grep confirms the same..)

Reply via email to