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

Javadoc tool hard ClassCastException failure breaks backward compatibility

    XMLWordPrintable

Details

    • 8
    • x86_64
    • generic

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0_65"
      Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      When a class annotation is placed on a method definition, the following fatal error occurs:
      com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.MethodDoc

      This should at best be a warning, and breaks backward compatibility with all previous JVM versions.

      REGRESSION. Last worked in version 7u76

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_65"
      Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Its a hard failure so ??? no idea what I am doing wrong or where

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Just display a warning rather than triggering a hard failure
      ACTUAL -
      com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.MethodDoc

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.MethodDoc

      *NO STACK TRACE* THIS MAKES THIS PRACTICALLY IMPOSSIBLE TO TRACK DOWN IN A LARGE PROJECT

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/com/sun/tools/doclets/internal/toolkit/Configuration.java#558

      The place above is the only place in your code where a ClassCastException could possibly be wrapped within a DocletAbortException. Possibly wrapping in a Fault would at least report a stack trace?
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Don't use JDK 1.8. It is impossible to change source code annotations in existing projects already in production at thousands of sites.

      Attachments

        Activity

          People

            ksrini Kumar Srinivasan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: