From the 1.3 API docs:
My method int[] getActiveMotors() obviously returns int[]. According to the documentation, this should be wrapped in it's appropriate class, then returned. Okay, so I can cast the returned Object to Integer[], right?
No.
The returned Object is in fact [I, by doing getClass{}.getName(). What class is [I exactly? It will not cast to anything useful, and appears to contain no useful data. Yes, my method returns valid data - it is hard coded into that method.
Any ideas on how to cast it correctly? It was working before, but adding a reference to the calling class caused the whole project to explode.
Edit: I cannot cast to anything - it appears the Object returned is invalid, but non-null.
gubmo
[This message was edited by gubmo on April 20, 2002 at 22:43.]
If the method completes normally, the value it returns is returned to the caller of invoke; if the value has a primitive type, it is first appropriately wrapped in an object. If the underlying method return type is void, the invocation returns null.
My method int[] getActiveMotors() obviously returns int[]. According to the documentation, this should be wrapped in it's appropriate class, then returned. Okay, so I can cast the returned Object to Integer[], right?
No.
The returned Object is in fact [I, by doing getClass{}.getName(). What class is [I exactly? It will not cast to anything useful, and appears to contain no useful data. Yes, my method returns valid data - it is hard coded into that method.
Any ideas on how to cast it correctly? It was working before, but adding a reference to the calling class caused the whole project to explode.
Edit: I cannot cast to anything - it appears the Object returned is invalid, but non-null.
gubmo
[This message was edited by gubmo on April 20, 2002 at 22:43.]