Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4492054
Votes 0
Synopsis javadoc does not parse valid assert statements that javac accepts
Category java:javadoctool
Reported Against merlin-beta , merlin-beta2
Release Fixed 1.4(merlin-beta3)
State 10-Fix Delivered, Verified, bug
Priority: 2-High
Related Bugs 4446137 , 4498879
Submit Date 15-AUG-2001
Description
..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.
Work Around
Use only simple one-argument form of assert.  This is suboptimal since the two-argument from allows more information to be provided.
Evaluation
oops.

 xxxxx@xxxxx  2001-08-15
Comments
  
  Include a link with my name & email   

Submitted On 14-MAR-2002
michaelyaakoby
I read that this bug is fixed and closed, yet I fail running javadoc on 
sources with asserts. I'm using J2SKD-1.4.0-b92 (latest version).


Submitted On 24-MAR-2002
MrCJava
i have the same problem i'm also using the latest version! :
((


Submitted On 30-MAR-2002
aeoun35g
I'll third that: same problem here with 1.4.0-b92, including
assert(true, "test") working in javadoc but not in javac. 
And yes, the workaround works.


Submitted On 13-AUG-2002
subrahmanyam
The same experience even with JDK1.4.1beta. javadoc fails
with the following forms of assertions:

  assert expr;
  assert (expr1) : expr2;


Submitted On 27-AUG-2002
tad1
JDK1.4.1RC still cannot handle assert statements.  Please 
unclose this log - it is NOT fixed.


Submitted On 27-AUG-2002
tad1
Oops! My error - I didn't realize "-source 1.4" was needed as 
a javadoc parameter for source with assert statements.  
Sorry....



PLEASE NOTE: JDK6 is formerly known as Project Mustang