ActionScript: Type coercion problem with BlazeDS/AMF and class interfaces

Posted by mike on Stack Overflow See other posts from Stack Overflow or by mike
Published on 2010-05-24T12:08:53Z Indexed on 2010/05/24 12:11 UTC
Read the original article Hit count: 307

Filed under:
|
|
|

Hi, I've got a problem with type coercion in a Java/Hibernate/BlazeDS/Flex-Setup.

First of all, my classes look like this:


--- JAVA ---

Interface I
(Abstract) Class A implements I
Class B extends A

--- ActionScript ---

Interface I
Class A implements I
Class B extends A


I got RemoteClass-Meta-Tags in all ActionScript-Classes/Interfaces I, A and B. Package structure and Class/Interface names are exactly the same.

Now here's the problem: My Java Service successfully retrieves objects of class B from my database via Hibernate. I got another class C which has a member property of interface type I, so it should be possible to assign an object of type B. But for some reason i get the following error message:

TypeError: Error #1034: cannot convert Object@28b44a89 to package.name.I

I checked the Java object type in the service and it is of type B and seems to be totally fine. Why can't the object of type B be assigned to a member variable of type I? This is driving me nuts.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript