ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 3045] - Javac needs assert enabler for JDK1.4
Date Mon, 17 Sep 2001 21:45:19 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3045>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3045





------- Additional Comments From steve_l@iseran.com  2001-09-17 14:45 -------
It's interesting to see where the impacts of the assert feature trickle in to 
ant. 

So far it's clear that javac and javadoc need to have -source 1.4 flag, but 
looking at the docs on how to use assert() 
http://java.sun.com/j2se/1.4/docs/guide/lang/assert.html shows that there are 
extra switches to enable and disable assertions in the java command. There is 
an "enablesystemassertions" flag to enable checks in the core libraries, and an 
counterpart "disablesystemassertions" to turn them off. For your own code, you 
need to set the "enableassertions" flag , perhaps followed by a list of 
packages which you want assertion checked.

There are a lot of places in ant where java is used as the basis for some other 
task, places in which assertion checking may need enabling. The key ones to 
focus on would have to be <java> itself, and <junit>, those being the places 
that your own code gets tested the most. 

I could imagine adding some simple "enableassertions" 
and "enablesystemassertions" flags to java, flags which are only used under 
1.4, and copy the assignment over to other tasks which make use of java 
underneath. We could even have some means of specifying the packages to enable 
for assertions. We couldnt of course actually have any assertions in ant, what 
with all the pre-1.4 java version to support.

Where I forsee trouble is in junit. The junit assert() method and the Sun 
assert keyword don't coexist. As junit 3.7 added an assertTrue() replacement 
for assert, new java1.4 source can be built with calls to assertTrue() living 
side by side with assert statements. People just need to go through their test 
code and replace methods. Then the junit tasks need to be extended with the 
ability to control whether asserts are enabled or not. 

I would conclude therefore, that supporting assert in ant, and ones own code, 
while valuable, will be time consuming.

Mime
View raw message