Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] assert in Java 1.4

Since we've now moved on to Java 1.4 officially, I'd like to start adding 
assertions into parser code.   Internal constructs (mainly class 
invariants) cannot be tested easily through JUnit tests.  I remember there 
being some rationale as to why we weren't going to do that ~ CDT 1.1 
timeframe and I cannot find the emails where that discussion took place. 
I've noticed a few uses of jface.util.Assert in some of the UI code, but 
other than that, no one else is jumping on the bandwagon.  (Note : 
jface.util.Assert 's documentation indicates its obsolesence in Java 1.4). 
 

So before I start going along this path, I just would like to get some 
consensus about (a) the need for us to use these constructs, (b) concerns 
about leaving them in production code and (c) whether or not we should 
structure them so they can be compiled out of the code by using guard 
condition referring to a static final boolean flag of sorts. 

Here are a couple of links that describe the way Java assertions work and 
how its OK to leave them in production code. 
http://java.sun.com/j2se/1.4.2/docs/guide/lang/assert.html
http://java.sun.com/docs/books/jls/assert-spec.html

JohnC
www.eclipse.org/cdt


Back to the top