Primitives not valid as parameters?

25 views
Skip to first unread message

Sean

unread,
Aug 9, 2010, 7:33:32 PM8/9/10
to gwtrpccommlayer
I was just working with an example and pulling my hair out trying to
figure out why

checkForUpdates(int p_weekNum, String p_homeTeam, String p_awayTeam)
did not work, but

checkForUpdates(); and

greet(String p_message)

worked.

I finally realized the message kept saying

checkForUpdates(java.lang.Integer p_weekNum, String p_homeTeam, String
p_awayTeam) is not a valid function call.

I switched my functions from the primitives to the object Integer and
it worked. Is this something I have to do or is this an oddity? I know
I don't need to do this for normal RPC's, not a huge thing, but just
wanted to know.

Nick Hebner

unread,
Aug 9, 2010, 8:21:36 PM8/9/10
to gwtrpcc...@googlegroups.com
I ran into this problem too. The problem is that primitive parameters get serialized as their object counterparts due to the use of java proxies on the client side. Then on the server side, we attempt to find a method using Class.getMethod() with the classes of the passed parameters. Since getMethod() searches for EXACT matches, it will not find your method with primitive types and will fail. I rewrote the server side method search to search through the methods for one that contains parameters that are Class.assignableFrom() the passed parameters.

See http://forums.sun.com/thread.jspa?threadID=5145767 (or search "java getmethod primitives") for more info.

Nick

jeff mchugh

unread,
Aug 11, 2010, 12:58:11 PM8/11/10
to gwtrpccommlayer
I'll look into this further and see what I can do to.

On Aug 9, 8:21 pm, Nick Hebner <hebn...@gmail.com> wrote:
> I ran into this problem too. The problem is that primitive parameters get
> serialized as their object counterparts due to the use of java proxies on
> the client side. Then on the server side, we attempt to find a method using
> Class.getMethod() with the classes of the passed parameters. Since
> getMethod() searches for EXACT matches, it will not find your method with
> primitive types and will fail. I rewrote the server side method search to
> search through the methods for one that contains parameters that are
> Class.assignableFrom() the passed parameters.
>
> Seehttp://forums.sun.com/thread.jspa?threadID=5145767(or search "java
> getmethod primitives") for more info.
>
> Nick
>

as...@linxa.com

unread,
Jan 25, 2013, 8:49:04 AM1/25/13
to gwtrpcc...@googlegroups.com
Hi Jeff. Great work! I've been looking for such a library for a while now.

Any news on the getMethod update that can handle primitive types?

Thanks,

Asim
Reply all
Reply to author
Forward
0 new messages