-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
beta3
-
generic, sparc
-
generic, solaris_7
-
Verified
JSR 41 has added a simple assertion facility to Java. In the proposed final draft, assert statements have one of two forms:
assert Expr_1;
assert Expr_1:Expr_2;
Both of these forms, with and without parentheses around Expr_1 and Expr_2, are recognized by javac when the "-source 1.4" flag is used. However, javadoc (Standard Doclet version 1.4 beta (04 Aug 2001)) only recognizes
assert(Expr)
and
assert (Expr)
independent of whether or not the "-source 1.4" flag is used. In particular, the program
/**
* JavaDoc for AssertTest2
*/
public class AssertTest2 {
public static void main(String argv[]) {
assert true;
assert true:true;
assert(true):true;
assert (true):true;
assert true:(true);
assert(true):(true);
assert (true):(true);
}
}
compiles with javac -source 1.4 but javadoc generates an error for each line of input. By commenting out all preceeding assert lines, I verified each line is rejected by itself; i.e. the 2nd and subsequent assert statements are *not* rejected because of poor "error" recovery in javadoc for the first "mistaken" line, "assert true".
Moreover, javadoc accepts the previous two-arg assert construction
assert(Expr_1, Expr_2); // no longer valid
Concretely,
/**
* JavaDoc for AssertTest3
*/
public class AssertTest3 {
public static void main(String argv[]) {
assert(true, true);
assert (true, true);
}
}
Is parsed by javadoc but rejected by javac. This should be fixed.
assert Expr_1;
assert Expr_1:Expr_2;
Both of these forms, with and without parentheses around Expr_1 and Expr_2, are recognized by javac when the "-source 1.4" flag is used. However, javadoc (Standard Doclet version 1.4 beta (04 Aug 2001)) only recognizes
assert(Expr)
and
assert (Expr)
independent of whether or not the "-source 1.4" flag is used. In particular, the program
/**
* JavaDoc for AssertTest2
*/
public class AssertTest2 {
public static void main(String argv[]) {
assert true;
assert true:true;
assert(true):true;
assert (true):true;
assert true:(true);
assert(true):(true);
assert (true):(true);
}
}
compiles with javac -source 1.4 but javadoc generates an error for each line of input. By commenting out all preceeding assert lines, I verified each line is rejected by itself; i.e. the 2nd and subsequent assert statements are *not* rejected because of poor "error" recovery in javadoc for the first "mistaken" line, "assert true".
Moreover, javadoc accepts the previous two-arg assert construction
assert(Expr_1, Expr_2); // no longer valid
Concretely,
/**
* JavaDoc for AssertTest3
*/
public class AssertTest3 {
public static void main(String argv[]) {
assert(true, true);
assert (true, true);
}
}
Is parsed by javadoc but rejected by javac. This should be fixed.
- duplicates
-
JDK-4498879 javadoc fails to parse assert statements correctly.
-
- Closed
-
- relates to
-
JDK-4446137 statement "assert (x) == y;" doesn't compile
-
- Closed
-