Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8041628

Javadoc cross-compilation problem

XMLWordPrintable

    • b53
    • Not verified

        From javadoc-dev@ojn

        Hello,

        When using jdk8 to generate javadoc for a 7 source base (some
        paths/arguments replaced by ...):

        javadoc -J-Xmx2g -XDignore.symbol.file -classpath ... -quiet -d ...
        -overview .../overview.html -sourcepath ... -source 1.7 -bootclasspath
        /usr/java/jdk1.7.0_51/jre/lib/resources.jar:/usr/java/jdk1.7.0_51/jre/lib/rt.jar:/usr/java/jdk1.7.0_51/jre/lib/jsse.jar:/usr/java/jdk1.7.0_51/jre/lib/jce.jar:/usr/java/jdk1.7.0_51/jre/lib/charsets.jar:/usr/java/jdk1.7.0_51/jre/lib/jfr.jar
        -extdirs /usr/java/jdk1.7.0_51/jre/lib/ext -tag test:X -tag run:X -tag
        bug:X -tag summary:X -tag vmoption:X -XDignore.symbol.file
        -windowtitle '...' ...

        I get the following error:

        javadoc: error -
        com.sun.tools.doclets.internal.toolkit.util.DocletAbortException:
        com.sun.tools.javac.code.Symbol$CompletionFailure: class file for
        java.lang.FunctionalInterface not found

        The same sources compile fine on jdk7 and also generate javadoc fine
        on jdk7. They also compile fine on jdk8 when setting -source 1.7,
        -bootclasspath and -extdirs.

        I think the error is caused by the implementation of
        RootDocImpl.isFunctionalInterface which calls toString on
        env.syms.functionalInterfaceType which in turn calls
        ClassType.getTypeArguments which calls complete().

        I tried to fix this by checking for env.source.allowLambda() before
        doing the String comparison [1] and this fixed my problem. I tried
        running javadoc on some other 8 and 7 source bases and didn't see any
        problem with this patch.

        Regards,
        -Gilles

        [1] http://cr.openjdk.java.net/~gdub/x-comp.patch

              jjg Jonathan Gibbons
              jjg Jonathan Gibbons
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: