JDK-7126832 : com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager cannot be cast
  • Type: Bug
  • Component: tools
  • Sub-Component: javah
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-01-03
  • Updated: 2012-08-15
  • Resolved: 2012-02-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u4Fixed 8 b25Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :


A DESCRIPTION OF THE PROBLEM :
An exception has occurred in the compiler (1.7.0_02). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
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:413)
	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)


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Just starting off with JNI.  Occurs when javah is run as an external tool in eclipse.


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
package com.redwoodsys.jvolcano.proto;

public class EngineFpgaJni {
	public native void set8(int offset, int value);
	public native int get8(int offset);
	public native void set16(int offset, int value);
	public native int get16(int offset);
	public native void set32(int offset, int value);
	public native int get32(int offset);
}

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

Comments
EVALUATION Refactoring occurred in JDK 7 to allow javah to use more of the functionality in javac. This caused code in javac to think that xxx.java on the command line is a source code file (as it is for javac) instead of a classname (as it is for javah).
24-01-2012

SUGGESTED FIX Preserve the names found on the javah command line as classnames into the javac processing so javac doesn't think they are source file names.
24-01-2012