Bug 1113877

Summary: java-1.8.0-openjdk: javadoc fails or generates incorrect serialized-form.html
Product: [Fedora] Fedora Reporter: Michal Srb <msrb>
Component: java-1.8.0-openjdkAssignee: Elliott Baron <ebaron>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: ahughes, dbhole, jvanek, msrb, omajid
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 11:50:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1106176    
Attachments:
Description Flags
reproducer none

Description Michal Srb 2014-06-27 06:34:40 UTC
Description of problem:

I am not sure if this is a real bug or just misconfiguration, but javadoc tool seems to behave improperly in some certain situations. To be more specific, when serializable classes are involved.

I have a simple project with only one class:

$ cat src/com/example/MyClass.java
package com.example;
import java.io.Serializable;
public class MyClass implements Serializable {
}

Note the fact that the class is serializable is important here.

Now I have some other class, which is not part of the project, but it accidentally resides in same package as class above. This class will later get on javadoc's classpath:

$ cat lib/com/example/MyServlet.java
package com.example;
import javax.servlet.http.HttpServlet;
public class MyServlet extends HttpServlet {
}

The class is also serializable.

Now I will build my project and try to generate javadocs for it:

$ javac -d classes src/com/example/MyClass.java
$ javadoc -classpath classes/:lib/ -sourcepath src/ -d apidocs com.example

Note the lib/ directory contains compiled "MyServlet" class. I am also putting compiled MyClass on classpath. It may seem strange, but maven-javadoc-plugin does just that. Another important thing here is that compiled class MyClass from my project is on classpath *before* lib/ directory. If I put it at the end, the problem will not occur.
The output from command above is:

Loading source files for package com.example...
Constructing Javadoc information...
Creating destination directory: "apidocs/"
Standard Doclet version 1.8.0_05
Building tree for all the packages and classes...
Generating apidocs/com/example/MyClass.html...
Generating apidocs/com/example/package-frame.html...
Generating apidocs/com/example/package-summary.html...
Generating apidocs/com/example/package-tree.html...
Generating apidocs/constant-values.html...
Generating apidocs/serialized-form.html...
javadoc: error - com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.servlet.http.HttpServlet not found
1 error

It seems that javadoc considers MyServlet class as part of the project from some reason and tries to include it in "serialized-form" page. If I add servlet-api JAR to classpath:

$ javadoc -classpath src/:lib/:`build-classpath glassfish-servlet-api` -sourcepath src/ -d apidocs com.example

javadoc will indeed generate serialized-form.html with following line:

"Class com.example.MyServlet extends javax.servlet.http.HttpServlet implements Serializable"

Note only serialized-form page seems to be affected, rest of the html pages seems correct. No mention of MyServlet elsewhere.

To sum it up, the problem occurs if:
- project contains at least one serializable class
- another serializable class which resides in same package as project's classes is on classpath
- compiled project classes are also on classpath and they are before class(es) from previous point

Version-Release number of selected component (if applicable):
java-1.8.0-openjdk-1.8.0.5-13.b13.fc21.x86_64

How reproducible:
100%

Steps to Reproduce:
1. download and unpack reproducer.tar.gz
2. yum install -y glassfish-servlet-api
3. javac -d classes src/com/example/MyClass.java
4. javac -cp `build-classpath glassfish-servlet-api` lib/com/example/MyServlet.java
5. javadoc -classpath classes/:lib/ -sourcepath src/ -d apidocs com.example

Actual results:
javadoc fails or generates incorrect serialized-form.html

Expected results:
no fail and serialized-form.html without elements which shouldn't be there

Additional info:
javadoc in openjdk7 behaves similarly, but it's less strict and it doesn't fail. It just prints warning about missing class file for javax.servlet.http.HttpServlet and continues. The serialized-form.html page is then completely empty (at least MyClass should be there).

Comment 1 Michal Srb 2014-06-27 06:38:04 UTC
Created attachment 912682 [details]
reproducer

Comment 2 Jaroslav Reznik 2015-03-03 16:04:28 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 3 Fedora End Of Life 2016-07-19 11:50:58 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 4 Omair Majid 2016-07-19 13:47:24 UTC
(In reply to Michal Srb from comment #0)
> Expected results:
> no fail and serialized-form.html without elements which shouldn't be there

If javadoc doesn't fail and generates a serialized-form.html file, what should it look like? I ran the reproducer and I get a web page that looks like (rougly):


Serialized Form

    Package com.example
        Class com.example.MyClass extends java.lang.Object implements Serializable