Skip to main content



      Home
Home » Eclipse Projects » Equinox » Stumped - class cast is not working
Stumped - class cast is not working [message #86735] Mon, 16 April 2007 12:06 Go to next message
Eclipse UserFriend
I have a piece of code that looks something like:

Object object = someFunctionCall();
Type[] types = object.getClass().getGenericInterfaces();

inspection of the types[] array shows two interfaces:

test.Foo
test.Bar

the following code causes a ClassCastException

test.Foo foo = (test.Foo) object;

Some things to note:

someFunctionCall() is in a different bundle
test.Foo is in a defferent bundle

Does anybody know how this situation can happen? I'm totally stumped.

Bryan
Re: Stumped - class cast is not working [message #86822 is a reply to message #86735] Mon, 16 April 2007 14:39 Go to previous message
Eclipse UserFriend
It turns out that if I Import-Package on test.Foo instead of
Require-Bundle that contains test.Foo, it works. Is this a bug?

Bryan


On 2007-04-16 11:06:53 -0500, Bryan Hunt <bhunt@mac.com> said:

> I have a piece of code that looks something like:
>
> Object object = someFunctionCall();
> Type[] types = object.getClass().getGenericInterfaces();
>
> inspection of the types[] array shows two interfaces:
>
> test.Foo
> test.Bar
>
> the following code causes a ClassCastException
>
> test.Foo foo = (test.Foo) object;
>
> Some things to note:
>
> someFunctionCall() is in a different bundle
> test.Foo is in a defferent bundle
>
> Does anybody know how this situation can happen? I'm totally stumped.
>
> Bryan
Previous Topic:How to obtain sample project from EclipseCon 2006 OSGi Component Programming tutorial
Next Topic:Eclipse 2.1->3.2 migration problem w.r.t. WizardNewFileCreationPage
Goto Forum:
  


Current Time: Tue Jul 22 00:54:53 EDT 2025

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

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

Back to the top