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]

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


Sergio Queiroz wrote:
> Em Fri, 02 Sep 2005 16:34:21 +0530, Ranjit Mathew escreveu:
> 
> 
>>To implement what you want, GCJ would have to recognise such patterns in
>>class files generated by itself, by javac, by ECJ, by Jikes, etc. -
>>needless to say, this is rather difficult and does not provide much
>>benefit.
> 
> 
> So, it would be nice to at least have in the GCJ documentation an
> explanation that --disable-assertions is only meaninful when compiling
> from source. With the current statement "By default, assertions are
> enabled when generating class files or when not optimizing, and disabled
> when generating optimized binaries." we think that GCJ will disable
> assertions when generating binaries even from .class files, as nothing is
> said that it will do differently. 
> 
> And why the proprietary JDKs can disable at runtime the use of assertions
> (with "java -disableassertions") for .class files generated by javac, ECJ,
> Jikes etc. (with the assert portions in it)? Isn't there an agreed
> structure for an assertion? 

>From a cursory glance at the relevant section in the JLS:

http://java.sun.com/docs/books/jls/third_edition/html/statements.html#14.10

and the JVM specification, I don't see a specification for the actual
implementation of assertions. That said, we also seem to be
using the same synthetic, static and final field "$assertionsDisabled"
that everyone else seems to be using. So we ought to be able
to set it to false when assertions are disabled by messing with
the class-loaders and class initialisation.

Tom is a person who's much better qualified to comment on this issue.

Ranjit.

-- 
Ranjit Mathew       Email: rmathew AT gmail DOT com

Bangalore, INDIA.     Web: http://ranjitmathew.hostingzero.com/


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