Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase the maximum number of javadoc warnings when compiling with Ant

I recently upgraded my development environment from Java 7 to Java 8, which now finds a large number of previously-undetected javadoc issues.

By default, Ant (invoked via Eclipse Mars) limits its warnings (and I assume errors) to 100:

Ant warnings limited to 100

Is there any parameter to force Ant to display all javadoc warnings instead of limiting to 100?

I attempted to use the -Xmaxwarns 1000 parameter via the compilerarg element, but it appears that the current Ant version in Eclipse Mars (Ant 1.9.4) javadoc task does not support the compilerarg element (it is only supported in the javac task):

<!-- Generate the API documentation. -->
<target name="javadoc" depends="clean" description="Generate the API documentation.">

    <!-- Create the build directory structure used by javadoc. -->
    <mkdir dir="${build.folder}" />
    <mkdir dir="${docs.folder}" />

    <!-- Run javadoc. -->

    <javadoc destdir="${docs.folder}/api" author="true" version="true" use="true" windowtitle="${documentation.title}">

        <compilerarg value="-Xmaxerrs 1000 -Xmaxwarns 1000" />

        <classpath>

        ...

ant: javadoc doesn't support the nested "compilerarg" element.

Java 8 javadoc does support these parameters (support was added in Java 7 b100):

C:\>javadoc -X
  -Xmaxerrs <number>               Set the maximum number of errors to print
  -Xmaxwarns <number>              Set the maximum number of warnings to print

Provided by standard doclet:
  -Xdocrootparent <url>            Replaces all appearances of @docRoot followed

                                   by /.. in doc comments with <url>
  -Xdoclint                        Enable recommended checks for problems in javadoc comments
  -Xdoclint:(all|none|[-]<group>)
        Enable or disable specific checks for problems in javadoc comments,
        where <group> is one of accessibility, html, missing, reference, or syntax.

These options are non-standard and subject to change without notice.

Conclusion: It appears that the Ant javadoc task is the limiting factor here, and if it supported the compilerarg flag, it would be possible to adjust the limit on errors and warnings.

like image 298
vallismortis Avatar asked Sep 18 '15 01:09

vallismortis


1 Answers

As you noted, -Xmaxwarns affects how many warnings the javadoc program outputs.

-Xmaxwarns can be passed to the javadoc program with nested <arg> elements:

<javadoc ...>
    <arg value="-Xmaxwarns"/>
    <arg value="200"/>
</javadoc>

In my own test case, I was able to increase the reported warnings above 100:

[javadoc] Generating Javadoc
...
[javadoc] 112 warnings
like image 167
Chad Nouis Avatar answered Nov 15 '22 13:11

Chad Nouis