Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Class Cast Exception in plugin
Class Cast Exception in plugin [message #594057] Fri, 27 March 2009 10:33
Rahul Yadav is currently offline Rahul YadavFriend
Messages: 65
Registered: July 2009
Member
Hello,

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
object of
"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.

Thanks
Previous Topic:Class Cast Exception in plugin
Next Topic:How to attach the debugger without the user interface
Goto Forum:
  


Current Time: Sat Apr 20 02:16:28 GMT 2024

Powered by FUDForum. Page generated in 0.02902 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top