This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

--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;
	}
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]