Assertions in static blocks ?

Ulf Zibis Ulf.Zibis at
Fri Feb 12 06:44:21 PST 2010

Am 12.02.2010 15:06, schrieb Ulf Zibis:
> Hi,
> in the following example, I have an assert statement in a static block 
> of my class.
> If accessing the static final constants from another class, the static 
> block is not executed.
> This causes the assertions to remain un-proofed, even if -ea -esa is set.
> Is that correct ?

If yes, javac should claim the code as never reached.

> IMO, assertions should always run, if -ea -esa is set.
> -Ulf


More information about the compiler-dev mailing list