Skip to main content

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

For what it's worth I'm strongly in favor of using the 1.4 assertions
facility.  It is clearly superior to the jface.util.Assert approach in
terms of performance.  Using a guard condition may be slightly more
efficient, but based on the design of 1.4 assetions it seems that they
would be able to come close to the same efficiency.  The assert keyword
is much easier to maintain than using a guard condition and, to me, that
outways a small effiency gain.  Does anyone know of any benchmarks
comparing execution times, or something like that?

  Jeremiah Lott
  TimeSys Corporation

PS - Yes this is my first message on the board, but I would like to
become a more active contributer to CDT.

-----Original Message-----
From: John Camelon [mailto:jcamelon@xxxxxxxxxx] 
Sent: Thursday, January 29, 2004 9:31 AM
To: cdt-dev@xxxxxxxxxxx
Subject: [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 _______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx http://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top