antgroovyjavadocgroovydoc

Any way to make Groovydoc remove (selected) package qualifiers as per Javadoc's 'noqualifier' option?


I've just started generating Groovydoc for a library I'm working on. However, the preponderance of java.lang and java.util and other common package prefixes in the method signatures is obscuring the real intent of the methods. I'd like to be able to generate the Groovydoc without these. As in the (made up) example:

List flatMap(Iterable itr, f)

rather than:

java.util.List flatMap(java.lang.Iterable itr, f)

(Some of my real examples are worse, having three or four something.entirely.Obvious arguments plus the return value.)

In Javadoc I'd achieve this with the -noqualifier option. No similar option is listed for groovydoc --help however.

Is there a way to do this with Groovydoc? If not, has anyone come up with any other reliable way to do this? (My fallback, which I haven't had a chance to try yet, it to attempt post-processing the generated documentation with Ant's replace task - but I wondered if there is a better way.)


Solution

  • The following Ant task hack seems to produce reasonable results for Groovy 2.4.3's Groovydoc output. (At least I haven't found anything it has broken yet.)

    <replace dir="build/doc/groovy/api">
        <replacefilter token="(java.lang.Object " value="("/>
        <replacefilter token=", java.lang.Object" value=", "/>
        <replacefilter token="java.lang." value=""/>
        <replacefilter token="java.util." value=""/>
        <!-- ... add more here ... -->
    </replace>
    

    Still wondering if there's a better way.