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

cannot be cast to com.sun.tools.javac.file.JavacFileManager

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 7
    • tools
    • x86
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.7.0_01"
      Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
      Java HotSpot(TM) Client VM (build 21.1-b02, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 x64 SP1 [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      I cannot generate header file for the class. javah returns error:

      com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager cannot be cast to com.sun.tools.javac.file.JavacFileManager

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. create XXX.java file with following content:
      public class XXX {
          public native static void destroy();
      }

      2. call javah -jni XXX.java

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Header file is generated
      ACTUAL -
      javah returns exception

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.ClassCastException: com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager cannot be cast to com.sun.tools.javac.file.JavacFileManager
              at com.sun.tools.javac.main.Main.compile(Main.java:411)
              at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
              at com.sun.tools.javah.JavahTask.run(JavahTask.java:513)
              at com.sun.tools.javah.JavahTask.run(JavahTask.java:335)
              at com.sun.tools.javah.Main.main(Main.java:46)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class XXX {
          public native static void destroy();
      }

      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: