--disable-assertions does not work when compiling from .class

Sergio Queiroz srmq@srmq.org
Fri Sep 2 10:22:00 GMT 2005


Hi,
I would like to use gcj to compile a .jar (of .class files) into an
executable. I've noticed that the option --disable-assertions does not
work in this case, the assertions are always enabled.
The simple class below show this behavior. When compiled from .java to
object code (with --disable-assertions) the assertion message will not
appear, as expected. However, when first compiled to .class (I use ecj)
and then to object code (also using --disable-assertions), the assertion
section will be executed.
--------------
public class AssertionTest {
	public static void main(String[] args) {
		System.out.println("Normal output");
		assert assertionsEnabled();
	}
	private static boolean assertionsEnabled() {
		System.out.println("Assertions are enabled");
		return true;
	}
}


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /