Javadoc Processing a File It Doesn’t Need To

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:
[cc lang=”java”]import javax.swing.JApplet;

public class A extends JApplet {
}[/cc]

File Broken.java:
[cc lang=”java”]class class Broken[/cc]

When I try to Javadoc just A.java using the command line

javadoc -d doc A.java

I get this output with an error:

$ 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: 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”.

Share

About Mathias

Software development engineer. Principal developer of DrJava. Recent Ph.D. graduate from the Department of Computer Science at Rice University.
This entry was posted in DrJava. Bookmark the permalink.

One Response to Javadoc Processing a File It Doesn’t Need To

Leave a Reply