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

current Javadoc's invocation and extension (Doclet) mechanisms are problematic

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 5.0, 6u3
    • Fix Version/s: 5.0u1
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b05
    • CPU:
      generic, x86
    • OS:
      generic

      Backports

        Description

        Javadoc's invocation and extension (Doclet) mechanisms are rather inelegant. You invoke it programmatically by passing a list of command-line args, exactly like a main(). You use this to pass it -doclet, -classpath and -docletpath. Javadoc creates a classloader from the paths you pass it, and uses that to load the named doclet class. It sets this classloader as the context classloader when invoking methods on the doclet, such as languageVersion(). (Annoyingly, it also fails to restore the context classloader, which has caused another
        bug already).

         

        The upshot of this seems to be that if tools.jar is not in the system classpath, javadoc and the doclet will load classes (such as LanguageVersion) from it using different

        classloaders. When javadoc goes to do its dynamic invocation on the doclet methods, it complains when its instanceof tests fail. So, the LanguageVersion that it is complaining about really is a LanguageVersion, but it's just one from a different classloader.

        The attached test case is a simple test case which demonstrates the problem using a dummy
        Doclet. It also shows that you *can* get things to work if you can just pass -classpath to the java command that is invoked. This is exactly what the WLS ant script does, and is why thing work in the 'devenv' environment but not with out-of-the-box ant.
        ###@###.### 10/11/04 16:31 GMT

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                sseligmasunw Scott Seligman (Inactive)
                Reporter:
                mmma Marvin Ma (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: