javadoc gives me a warning (and doesn't generate a link) when I try to link to one member type using just its simple name from a doc comment for another member of the same enclosing type. In doc comments for the enclosing type, I can link to either member type using their simple names. See the example below. Is this a bug?
In the example below, the link to inner class Baz {@link Baz} is a broken
link -- it appears in the class comment for inner class Bar.
(Links from one member type to the other are handled correctly if the target member type's name is qualified by the enclosing type's name, so there is a straightforward workaround.)
Below is an example preceded by the warnings generated by javadoc for this example using the 1.4.1 SDK. I get the same warnings from javadoc in 1.4.0, 1.3.1, and 1.2.2, however.
[terrier] 95 % java -version
java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b19)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b19, mixed mode)
[terrier] 96 % javadoc Foo.java
Loading source file Foo.java...
Constructing Javadoc information...
Standard Doclet version 1.4.1
Generating constant-values.html...
Building tree for all the packages and classes...
Building index for all the packages and classes...
Generating overview-tree.html...
Generating index-all.html...
Generating deprecated-list.html...
Building index for all classes...
Generating allclasses-frame.html...
Generating allclasses-noframe.html...
Generating index.html...
Generating packages.html...
Generating Foo.html...
Generating Foo.Bar.html...
Foo.java:25: warning - Tag @link: reference not found: Baz Baz
Foo.java:25: warning - Tag @link: reference not found: Baz#doBaz Baz.doBaz
Foo.java:33: warning - Tag @link: reference not found: Baz Baz
Foo.java:33: warning - Tag @link: reference not found: Baz#doBaz Baz.doBaz
Generating Foo.Baz.html...
Foo.java:42: warning - Tag @link: reference not found: Bar Bar
Foo.java:42: warning - Tag @link: reference not found: Bar#doBar Bar.doBar
Foo.java:50: warning - Tag @link: reference not found: Bar Bar
Foo.java:50: warning - Tag @link: reference not found: Bar#doBar Baz.doBaz
Generating serialized-form.html...
Generating package-list...
Generating help-doc.html...
Generating stylesheet.css...
8 warnings
/**
* The <code>Foo</code> interface.
*
* <p>Look at {@link Baz Baz} and {@link Baz#doBaz Baz.doBaz}
* and {@link Bar Bar} and {@link Bar#doBar Bar.doBar}
* from the <code>Foo</code> class.
*/
public interface Foo {
/**
* The <code>Foo.doFoo</code> method.
*
* <p>Look at {@link Baz Baz} and {@link Baz#doBaz Baz.doBaz}
* and {@link Bar Bar} and {@link Bar#doBar Bar.doBar}
* from the <code>Foo.doFoo</code> method.
*/
void doFoo(Bar bar, Baz baz);
/**
* The <code>Bar</code> interface.
*
* <p>Look at {@link Baz Baz} and {@link Baz#doBaz Baz.doBaz}
* from the <code>Bar</code> class.
*/
interface Bar {
/**
* The <code>Bar.doBar</code> method.
*
* <p>Look at {@link Baz Baz} and {@link Baz#doBaz Baz.doBaz}
* from the <code>Bar.doBar</code> method.
*/
void doBar(Baz baz);
}
/**
* The <code>Baz</code> interface.
*
* <p>Look at {@link Bar Bar} and {@link Bar#doBar Bar.doBar}
* from the <code>Baz</code> class.
*/
interface Baz {
/**
* The <code>Baz.doBaz</code> method.
*
* <p>Look at {@link Bar Bar} and {@link Bar#doBar Baz.doBaz}
* from the <code>Baz.doBaz</code> method.
*/
void doBaz(Bar bar);
}
}
----
In its simplest form, the above problem reduces to {@link Baz} being
a broken link, producing this warning:
% javadoc FooSimple.java
FooSimple.java:6: warning - Tag @link: reference not found: Baz
public interface FooSimple {
/**
* Look at {@link Baz}.
*/
interface Bar {
}
interface Baz {
}
}
In the example below, the link to inner class Baz {@link Baz} is a broken
link -- it appears in the class comment for inner class Bar.
(Links from one member type to the other are handled correctly if the target member type's name is qualified by the enclosing type's name, so there is a straightforward workaround.)
Below is an example preceded by the warnings generated by javadoc for this example using the 1.4.1 SDK. I get the same warnings from javadoc in 1.4.0, 1.3.1, and 1.2.2, however.
[terrier] 95 % java -version
java version "1.4.1-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b19)
Java HotSpot(TM) Client VM (build 1.4.1-rc-b19, mixed mode)
[terrier] 96 % javadoc Foo.java
Loading source file Foo.java...
Constructing Javadoc information...
Standard Doclet version 1.4.1
Generating constant-values.html...
Building tree for all the packages and classes...
Building index for all the packages and classes...
Generating overview-tree.html...
Generating index-all.html...
Generating deprecated-list.html...
Building index for all classes...
Generating allclasses-frame.html...
Generating allclasses-noframe.html...
Generating index.html...
Generating packages.html...
Generating Foo.html...
Generating Foo.Bar.html...
Foo.java:25: warning - Tag @link: reference not found: Baz Baz
Foo.java:25: warning - Tag @link: reference not found: Baz#doBaz Baz.doBaz
Foo.java:33: warning - Tag @link: reference not found: Baz Baz
Foo.java:33: warning - Tag @link: reference not found: Baz#doBaz Baz.doBaz
Generating Foo.Baz.html...
Foo.java:42: warning - Tag @link: reference not found: Bar Bar
Foo.java:42: warning - Tag @link: reference not found: Bar#doBar Bar.doBar
Foo.java:50: warning - Tag @link: reference not found: Bar Bar
Foo.java:50: warning - Tag @link: reference not found: Bar#doBar Baz.doBaz
Generating serialized-form.html...
Generating package-list...
Generating help-doc.html...
Generating stylesheet.css...
8 warnings
/**
* The <code>Foo</code> interface.
*
* <p>Look at {@link Baz Baz} and {@link Baz#doBaz Baz.doBaz}
* and {@link Bar Bar} and {@link Bar#doBar Bar.doBar}
* from the <code>Foo</code> class.
*/
public interface Foo {
/**
* The <code>Foo.doFoo</code> method.
*
* <p>Look at {@link Baz Baz} and {@link Baz#doBaz Baz.doBaz}
* and {@link Bar Bar} and {@link Bar#doBar Bar.doBar}
* from the <code>Foo.doFoo</code> method.
*/
void doFoo(Bar bar, Baz baz);
/**
* The <code>Bar</code> interface.
*
* <p>Look at {@link Baz Baz} and {@link Baz#doBaz Baz.doBaz}
* from the <code>Bar</code> class.
*/
interface Bar {
/**
* The <code>Bar.doBar</code> method.
*
* <p>Look at {@link Baz Baz} and {@link Baz#doBaz Baz.doBaz}
* from the <code>Bar.doBar</code> method.
*/
void doBar(Baz baz);
}
/**
* The <code>Baz</code> interface.
*
* <p>Look at {@link Bar Bar} and {@link Bar#doBar Bar.doBar}
* from the <code>Baz</code> class.
*/
interface Baz {
/**
* The <code>Baz.doBaz</code> method.
*
* <p>Look at {@link Bar Bar} and {@link Bar#doBar Baz.doBaz}
* from the <code>Baz.doBaz</code> method.
*/
void doBaz(Bar bar);
}
}
----
In its simplest form, the above problem reduces to {@link Baz} being
a broken link, producing this warning:
% javadoc FooSimple.java
FooSimple.java:6: warning - Tag @link: reference not found: Baz
public interface FooSimple {
/**
* Look at {@link Baz}.
*/
interface Bar {
}
interface Baz {
}
}