Name: bsC130419 Date: 06/18/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
I've written a trivial test program to try out the new Assertion facility in JDK
1.4, and I notice that the AssertException that is thrown in my simple test
program contains the wrong line number as the origin of the exception. Instead
of showing line 8 as the line where the exception occurred, it shows line 1.
Here's the test program:
cindercone% cat AssertTest.java
class AssertTest {
public static void main(String[] args) {
System.out.println("Start of 1st assert test");
assert 1==1;
System.out.println("End of 1st assert test");
System.out.println("Start of 2nd assert test");
assert 1==5;
System.out.println("End of 2nd assert test");
}
}
% javac -source 1.4 AssertTest.java
% java -ea AssertTest
Start of 1st assert test
End of 1st assert test
Start of 2nd assert test
Exception in thread "main" java.lang.AssertionError
at AssertTest.main(AssertTest.java:1)
%
------------------------------------------------
(Review ID: 126752)
======================================================================
- duplicates
-
JDK-4469737 Line number information for asserts is misleading
-
- Closed
-