-
Bug
-
Resolution: Fixed
-
P4
-
1.1.8, 1.2.0
-
1.2fcs
-
generic
-
generic
-
Verified
I have two classes, one of which inherits the other.
The inherited class has a private method, the inheriting class
has a protected method with the same name and signature.
This is legal, albeit dubious, Java code.
javadoc correctly does not report on the private method,
but incorrectly reports that that the protected method
overrides the private one. This is not only confusing
to the reader, it also results in invalid HTML, rejected
by linklint, because an invalid reference is generated to
an missing named anchor.
A simple test case suffices; the real world example is JavaTest,
used for JCK.
-------A.java-------
package P;
public class A {
private void usage() { }
}
------------B.java-----------
package P;
public class B extends A {
protected void usage() { }
}
--------------------------
compile them:
gzilla% jc -d . P/*.java
gzilla%
javadoc them:
gzilla% javadoc P
Loading source files for P
Generating package.html
Generating documentation for class P.A
Generating documentation for class P.B
Generating index
Sorting 3 items...done
Generating tree
gzilla%
Look at results:
-----------P.A.html----------------
---note no ref to usage------------
gzilla% more P.A.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Thu Mar 05 13:09:00 PST 1998 -->
<title>
Class P.A
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-P.html">This P
ackage</a> <a href="Package-P.html">Previous</a> <a href="P.B.html#_top_">Next</a> <a href="AllNames.html">Inde
x</a></pre>
<hr>
<h1>
Class P.A
</h1>
<pre>
java.lang.Object
|
+----P.A
</pre>
<hr>
<dl>
<dt> public class <b>A</b>
<dt> extends Object
</dl>
<hr>
<a name="index"></a>
<h2>
<img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#A()"><b>A</b></a>()
<dd>
</dl>
<a name="constructors"></a>
<h2>
<img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="A"></a>
<a name="A()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>A</b>
<pre>
public A()
</pre>
<hr>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-P.html">This P
ackage</a> <a href="Package-P.html">Previous</a> <a href="P.B.html#_top_">Next</a> <a href="AllNames.html">Inde
x</a></pre>
</body>
</html>
gzilla%
-------------P.B.html--------------
-------note ref in Overrides to P.A.html#usage------------
gzilla% more P.B.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Thu Mar 05 13:09:00 PST 1998 -->
<title>
Class P.B
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-P.html">This P
ackage</a> <a href="P.A.html#_top_">Previous</a> <a href="Package-P.html">Next</a> <a href="AllNames.html">Inde
x</a></pre>
<hr>
<h1>
Class P.B
</h1>
<pre>
java.lang.Object
|
+----<a href="P.A.html#_top_">P.A</a>
|
+----P.B
</pre>
<hr>
<dl>
<dt> public class <b>B</b>
<dt> extends <a href="P.A.html#_top_">A</a>
</dl>
<hr>
<a name="index"></a>
<h2>
<img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#B()"><b>B</b></a>()
<dd>
</dl>
<h2>
<img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#usage()"><b>usage</b></a>()
<dd>
</dl>
<a name="constructors"></a>
<h2>
<img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="B"></a>
<a name="B()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>B</b>
<pre>
public B()
</pre>
<a name="methods"></a>
<h2>
<img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="usage()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="usage"><b>usage</b></a>
<pre>
protected void usage()
</pre>
<dl>
<dd><dl>
<dt> <b>Overrides:</b>
<dd> <a href="P.A.html#usage()">usage</a> in class <a href="P.A.html#_top_">A</a>
</dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-P.html">This P
ackage</a> <a href="P.A.html#_top_">Previous</a> <a href="Package-P.html">Next</a> <a href="AllNames.html">Inde
x</a></pre>
</body>
</html>
gzilla%
The inherited class has a private method, the inheriting class
has a protected method with the same name and signature.
This is legal, albeit dubious, Java code.
javadoc correctly does not report on the private method,
but incorrectly reports that that the protected method
overrides the private one. This is not only confusing
to the reader, it also results in invalid HTML, rejected
by linklint, because an invalid reference is generated to
an missing named anchor.
A simple test case suffices; the real world example is JavaTest,
used for JCK.
-------A.java-------
package P;
public class A {
private void usage() { }
}
------------B.java-----------
package P;
public class B extends A {
protected void usage() { }
}
--------------------------
compile them:
gzilla% jc -d . P/*.java
gzilla%
javadoc them:
gzilla% javadoc P
Loading source files for P
Generating package.html
Generating documentation for class P.A
Generating documentation for class P.B
Generating index
Sorting 3 items...done
Generating tree
gzilla%
Look at results:
-----------P.A.html----------------
---note no ref to usage------------
gzilla% more P.A.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Thu Mar 05 13:09:00 PST 1998 -->
<title>
Class P.A
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-P.html">This P
ackage</a> <a href="Package-P.html">Previous</a> <a href="P.B.html#_top_">Next</a> <a href="AllNames.html">Inde
x</a></pre>
<hr>
<h1>
Class P.A
</h1>
<pre>
java.lang.Object
|
+----P.A
</pre>
<hr>
<dl>
<dt> public class <b>A</b>
<dt> extends Object
</dl>
<hr>
<a name="index"></a>
<h2>
<img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#A()"><b>A</b></a>()
<dd>
</dl>
<a name="constructors"></a>
<h2>
<img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="A"></a>
<a name="A()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>A</b>
<pre>
public A()
</pre>
<hr>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-P.html">This P
ackage</a> <a href="Package-P.html">Previous</a> <a href="P.B.html#_top_">Next</a> <a href="AllNames.html">Inde
x</a></pre>
</body>
</html>
gzilla%
-------------P.B.html--------------
-------note ref in Overrides to P.A.html#usage------------
gzilla% more P.B.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Thu Mar 05 13:09:00 PST 1998 -->
<title>
Class P.B
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-P.html">This P
ackage</a> <a href="P.A.html#_top_">Previous</a> <a href="Package-P.html">Next</a> <a href="AllNames.html">Inde
x</a></pre>
<hr>
<h1>
Class P.B
</h1>
<pre>
java.lang.Object
|
+----<a href="P.A.html#_top_">P.A</a>
|
+----P.B
</pre>
<hr>
<dl>
<dt> public class <b>B</b>
<dt> extends <a href="P.A.html#_top_">A</a>
</dl>
<hr>
<a name="index"></a>
<h2>
<img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
<dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#B()"><b>B</b></a>()
<dd>
</dl>
<h2>
<img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
<dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
<a href="#usage()"><b>usage</b></a>()
<dd>
</dl>
<a name="constructors"></a>
<h2>
<img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="B"></a>
<a name="B()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>B</b>
<pre>
public B()
</pre>
<a name="methods"></a>
<h2>
<img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="usage()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="usage"><b>usage</b></a>
<pre>
protected void usage()
</pre>
<dl>
<dd><dl>
<dt> <b>Overrides:</b>
<dd> <a href="P.A.html#usage()">usage</a> in class <a href="P.A.html#_top_">A</a>
</dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a> <a href="tree.html">Class Hierarchy</a> <a href="Package-P.html">This P
ackage</a> <a href="P.A.html#_top_">Previous</a> <a href="Package-P.html">Next</a> <a href="AllNames.html">Inde
x</a></pre>
</body>
</html>
gzilla%
- duplicates
-
JDK-4246235 'javadoc -public' generates 'Overrides' statement for protected method
-
- Closed
-