1 Reply Latest reply: Apr 29, 2010 3:51 AM by thomas.behr RSS

    javadoc hit by javac bug, run with Eclipse compiler?

    843810
      Is there any way to run the javadoc tool with an alternative Java compiler, such as the one in Eclipse?

      I ran into two severe bugs with the JDK 1.6.0_20 javac compiler: [6294779|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6294779] and [6946211|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6946211] (may not be publicly visible yet). So I've now changed my project build to use the [Eclipse batch compiler|http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm], which is generally much higher quality than what Sun (Oracle) provides. Now the code compiles fine.

      The problem is that Javadoc generation is still failing. Apparently the javadoc tool somehow uses the javac compiler, and since it's erroring out the javadoc doesn't get generated. I'm getting errors like this out of a Maven build.
      Embedded error: Error rendering Maven report: Exit code: 1 - E:\Hudson\jobs\HL7 V3 - Site\workspace\src\main\java\com\axolotl\hl7\v3\r1\datatypes\interfaces\informative\PPD.java:125: clone() in java.lang.Object cannot implement clone() in com.axolotl.hl7.v3.r1.datatypes.interfaces.basic.QTY; attempting to assign weaker access privileges; was public
      public interface PPD<T extends QTY & LiteralizableR1> extends QTY,
      
      ^E:\Hudson\jobs\HL7 V3 - Site\workspace\src\main\java\com\axolotl\hl7\v3\r1\datatypes\impl\generic\IVLimpl.java:39: clone() in java.lang.Object cannot implement clone() in com.axolotl.hl7.v3.r1.datatypes.interfaces.introduction.ANY; attempting to assign weaker access privileges; was public^
      ^abstract class IVLimpl<T extends ANY & LiteralizableR1> extends SETimpl<T>^
      
      E:\Hudson\jobs\HL7 V3 - Site\workspace\src\main\java\com\axolotl\hl7\v3\r1\datatypes\impl\generic\IVL_QTYimpl.java:19: clone() in java.lang.Object cannot implement clone() in com.axolotl.hl7.v3.r1.datatypes.interfaces.basic.QTY; attempting to assign weaker access privileges; was public
      abstract class IVL_QTYimpl<T extends QTY & LiteralizableR1> extends IVLimpl<T>
      
      ^E:\Hudson\jobs\HL7 V3 - Site\workspace\src\main\java\com\axolotl\hl7\v3\r1\datatypes\impl\informative\PPDimpl.java:34: clone() in java.lang.Object cannot implement clone() in com.axolotl.hl7.v3.r1.datatypes.interfaces.basic.QTY; attempting to assign weaker access privileges; was public^
      ^abstract class PPDimpl<T extends QTY & LiteralizableR1> extends ANYimpl^
      
      java.lang.NullPointerException
      at com.sun.tools.javac.jvm.ClassReader.findMethod(ClassReader.java:974)
      at com.sun.tools.javac.jvm.ClassReader.readEnclosingMethodAttr(ClassReader.java:926)
      at com.sun.tools.javac.jvm.ClassReader.readMemberAttr(ClassReader.java:909)
      at com.sun.tools.javac.jvm.ClassReader.readClassAttr(ClassReader.java:1053)
      at com.sun.tools.javac.jvm.ClassReader.readClassAttrs(ClassReader.java:1067)
      at com.sun.tools.javac.jvm.ClassReader.readClass(ClassReader.java:1560)
      at com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:1658)
      at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:1845)
      at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1777)
      at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
      at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:758)
      at com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:690)
      at com.sun.tools.javadoc.ClassDocImpl.getFlags(ClassDocImpl.java:105)
      at com.sun.tools.javadoc.ClassDocImpl.isAnnotationType(ClassDocImpl.java:116)
      at com.sun.tools.javadoc.DocEnv.isAnnotationType(DocEnv.java:574)
      at com.sun.tools.javadoc.DocEnv.getClassDoc(DocEnv.java:546)
      at com.sun.tools.javadoc.PackageDocImpl.getClasses(PackageDocImpl.java:154)
      at com.sun.tools.javadoc.PackageDocImpl.addAllClassesTo(PackageDocImpl.java:170)
      at com.sun.tools.javadoc.RootDocImpl.classes(RootDocImpl.java:178)
      at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:96)
      at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
      at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42)
      at com.sun.tools.doclets.standard.Standard.start(Standard.java:23)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
      at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143)
      at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
      at com.sun.tools.javadoc.Start.begin(Start.java:128)
      at com.sun.tools.javadoc.Main.execute(Main.java:41)
      at com.sun.tools.javadoc.Main.main(Main.java:31)
      
      Command line was:"C:\Program Files\Java\jdk1.6.0_20\jre\..\bin\javadoc.exe" -J-Xmx1600m @options @packages
      Any suggestions to fix or work around the problem would be appreciated.

      Edited by: Nick_Radov on Apr 28, 2010 8:28 PM
        • 1. Re: javadoc hit by javac bug, run with Eclipse compiler?
          thomas.behr
          Nick_Radov wrote:
          Is there any way to run the javadoc tool with an alternative Java compiler, such as the one in Eclipse?
          I don't think so. However, Javadoc has a [-bootclasspath|http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#bootclasspath] option - you may be able to use it to replace Sun's javac implementation with another one of your choosing (I've never tried something like this myself, though).

          Since bug [6294779|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6294779] seems to be fixed in Java 7, how about trying to use Java 7's Javadoc to generate the API documentation of your project?