|Class Cast Exception in plugin [message #594057]
||Fri, 27 March 2009 10:33
| Rahul Yadav
Registered: July 2009
There is a Class B that extends class A, now as per basic object Oriented
concepts i should be able to cast an object of class B into A, but i get
a class cast exception here.This is possible only if class A and B are
loaded by different Class Loaders and this is what happening in my case.
There is a class "com.sun.source.util.Trees", Trees.instance() method of
this class return an object of "Trees" but internally it creates an
"com.sun.tools.javac.api.JavacTrees" which is a sub class of "Trees" and
cast it into Trees, i get a class cast exception here.
If we use the same classes in a simple java project, JavacTrees and
Trees are loaded by same classloader and it runs fine. But if invoked
from a plug-in project they get loaded by different classloaders and cast
exception is reported.
Powered by FUDForum
. Page generated in 0.01894 seconds