lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramkumar R. Aiyengar" <>
Subject Re: Odd test failures
Date Mon, 01 Sep 2014 20:44:07 GMT
On Mon, Sep 1, 2014 at 8:54 PM, Dawid Weiss <>

> 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..)

View raw message