Skip to content

Instantly share code, notes, and snippets.

@nking
Created May 18, 2012 22:28

Revisions

  1. nking revised this gist May 20, 2012. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,9 @@
    If you're seeing
    java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc
    java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast
    to com.sun.javadoc.AnnotationTypeDoc

    the classloader used by the javadoc tool is not finding your 3rd party annotation definitions.
    the classloader used by the javadoc tool is not finding your 3rd party
    annotation definitions.

    This is a problem present in JDK 1.6.

  2. nking revised this gist May 20, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,8 @@ the classloader used by the javadoc tool is not finding your 3rd party annotatio

    This is a problem present in JDK 1.6.

    An quick workaround to enable the classloader to find the annotation definitions is to add them to the bootclasspath using the -bootclasspath option for javadoc.
    An quick workaround to enable the classloader to find the annotation definitions
    is to add them to the bootclasspath using the -bootclasspath option for javadoc.

    -----
    Java language spec, 3rd edition:
  3. nking revised this gist May 20, 2012. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -7,3 +7,18 @@ This is a problem present in JDK 1.6.

    An quick workaround to enable the classloader to find the annotation definitions is to add them to the bootclasspath using the -bootclasspath option for javadoc.

    -----
    Java language spec, 3rd edition:
    If the JVM is looking for references to another class or interface within
    a loaded class and determines that the bootstrap class loader didn't
    already load it, it uses the class loader delegation model for
    the first searches:
    - it uses the parent classloader to search for the class. If the class
    was not found using the parent class loader, it uses the class loader.

    The hierarchy of class loaders is:
    - bootstrap classloader is parent,
    - extensions classloader is child
    - system classloader is a child of extensions classloader
    - application specific classloaders are children of the
    system classloader.
  4. nking created this gist May 18, 2012.
    9 changes: 9 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    If you're seeing
    java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc

    the classloader used by the javadoc tool is not finding your 3rd party annotation definitions.

    This is a problem present in JDK 1.6.

    An quick workaround to enable the classloader to find the annotation definitions is to add them to the bootclasspath using the -bootclasspath option for javadoc.