This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
--disable-assertions does not work when compiling from .class
- From: Sergio Queiroz <srmq at srmq dot org>
- To: java at gcc dot gnu dot org
- Date: Fri, 02 Sep 2005 11:43:59 +0200
- Subject: --disable-assertions does not work when compiling from .class
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;
}
}