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 #52272] Fri, 27 March 2009 10:33
Rahul Yadav is currently offline Rahul YadavFriend
Messages: 65
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
object of
"" 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.

Previous Topic:CertPathBuilderException from Plugin
Next Topic:Class Cast Exception in plugin
Goto Forum:

Current Time: Tue Jun 15 22:26:45 GMT 2021

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

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

Back to the top