I’m running the command line Javadoc tool. In the current directory, I have two files, A.java (which is syntactically correct), and a Broken.java (which has a syntax error in it). A.java doesn’t refer to Broken.java.
File A.java:
1 2 3 4 |
File Broken.java:
1 | class class Broken |
When I try to Javadoc just A.java using the command line
javadoc -d doc A.java
I get this output with an error:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | $ javadoc -d doc A.java Loading source file A.java... Constructing Javadoc information... Standard Doclet version 1.6.0_21 Building tree for all the packages and classes... Generating doc\A.html... Generating doc\package-frame.html... Generating doc\package-summary.html... Generating doc\package-tree.html... Generating doc\constant-values.html... Generating doc\serialized-form.html... .\Broken.java:1: <identifier> expected class class Broken ^ .\Broken.java:1: reached end of file while parsing class class Broken ^ Building index for all the packages and classes... Generating doc\overview-tree.html... Generating doc\index-all.html... Generating doc\deprecated-list.html... Building index for all classes... Generating doc\allclasses-frame.html... Generating doc\allclasses-noframe.html... Generating doc\index.html... Generating doc\help-doc.html... Generating doc\stylesheet.css... 2 errors |
If I don’t have an “extends” clause for the class A, then Javadoc doesn’t try to process the Broken.java file.
Can somebody please tell me why Javadoc is looking at Broken.java, and how I can prevent it from doing that? How do I tell Javadoc to just process the file I am specifying?
I’m using a Mac with OS X 10.4, Java 5, but this also occurs on Windows with Java 6 Update 21.
I was told to just fix the syntax error, but as IDE developer, that’s obviously not the solution for me. I can’t tell my users to “just fix the syntax error”.
One Response to Javadoc Processing a File It Doesn’t Need To