This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 202220 - Javadoc does not work if no package.
Summary: Javadoc does not work if no package.
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.0.1
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-16 12:32 UTC by evariste
Modified: 2014-02-05 02:46 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description evariste 2011-09-16 12:32:37 UTC
Product Version = NetBeans IDE 7.0.1 (Build 201107282000)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.7.0
Runtime = Java HotSpot(TM) Client VM 21.0-b17

With no package (default package) run javadoc fails with an error "Can't find source or package".  This used to work.
Comment 1 Jan Becicka 2011-09-19 13:53:52 UTC
implemented in java/project?
Comment 2 MackSix 2014-01-30 08:14:33 UTC
Workaround :

Find this section in build-impl.xml for your project :

<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
    <classpath>
        <path path="${javac.classpath}"/>
    </classpath>
    <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}">
        <filename name="**/*.java"/>
    </fileset>
    <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
        <include name="**/*.java"/>
        <exclude name="*.java"/>
    </fileset>
    <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
</javadoc>

Change this line :

    <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}">

To this by removing "*.java," :

    <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
Comment 3 Tomas Zezula 2014-02-03 11:04:57 UTC
The reason why it's disabled is a JDK issue http://bugs.java.com/view_bug.do?bug_id=5101868. When there are classes in default package the JavaDoc crashes with NPE (even when there are classes in non default package). So the issues affects everyone having class(es) in default package. With current state (exclude="*.java") it affects just users having only default package.

>To this by removing "*.java,"
In general it will introduce the NPE back, see issue #197129 for details.
Even the issue has FIXED-IN set to JDK 8.0 it seems it's already fixed in JDK 7.0 (at least update 40+). So I will remove the exclude.
Comment 4 MackSix 2014-02-03 12:56:33 UTC
(In reply to Tomas Zezula from comment #3)
> The reason why it's disabled is a JDK issue
> http://bugs.java.com/view_bug.do?bug_id=5101868. When there are classes in
> default package the JavaDoc crashes with NPE (even when there are classes in
> non default package). So the issues affects everyone having class(es) in
> default package. With current state (exclude="*.java") it affects just users
> having only default package.
> 
> >To this by removing "*.java,"
> In general it will introduce the NPE back, see issue #197129 for details.
> Even the issue has FIXED-IN set to JDK 8.0 it seems it's already fixed in
> JDK 7.0 (at least update 40+). So I will remove the exclude.

I have found that in JDK 7 u51 that if there is no package, I get a bunch of errors generating Javadoc when I remove "*.java," for a no package bunch of source files.. If there is a package there is no errors.
Comment 5 Tomas Zezula 2014-02-03 14:10:15 UTC
The errors are probably OK as default package should not be used.
The presence of the JDK issue causes:
java.lang.NullPointerException
	at com.sun.tools.doclets.formats.html.PackageUseWriter.generatePackageUse(PackageUseWriter.java:180)
	at com.sun.tools.doclets.formats.html.PackageUseWriter.generatePackageList(PackageUseWriter.java:124)
	at com.sun.tools.doclets.formats.html.PackageUseWriter.generatePackageUse(PackageUseWriter.java:110)
	at com.sun.tools.doclets.formats.html.PackageUseWriter.generatePackageUseFile(PackageUseWriter.java:99)
	at com.sun.tools.doclets.formats.html.PackageUseWriter.generate(PackageUseWriter.java:78)
	at com.sun.tools.doclets.formats.html.ClassUseWriter.generate(ClassUseWriter.java:116)
	at com.sun.tools.doclets.formats.html.HtmlDoclet.generateOtherFiles(HtmlDoclet.java:92)
	at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:122)
	at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
Comment 6 Tomas Zezula 2014-02-03 16:28:35 UTC
Fixed jet-main 5339904cede9
Comment 7 Quality Engineering 2014-02-05 02:46:40 UTC
Integrated into 'main-silver', will be available in build *201402050001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/5339904cede9
User: Tomas Zezula <tzezula@netbeans.org>
Log: #202220:Javadoc does not work if no package.