KeyValuePair value type

Bug #778503 reported by Prageeth Silva
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MUGLE
New
High
Unassigned

Bug Description

Looks like GWT doesn't allow Object as a type to be returned or used as method parameters (or used as fields) in classes that go through RPC.

Therefore I was trying to implement Serializable as the value field (and also for the particular getter and setter).

I can't remember why we had a conversation about the client api returning Object instead of Serializable; the head revision contains Serializable in the KeyValueService in the client api.

For now, I'm planning to convert the KeyValuePair (Client wrapper class) to use Serializable for the value field (and the getter/setter).

Any thoughts? Am I missing something that we discussed the other day?

Revision history for this message
Prageeth Silva (prageethsilva) wrote :

OK, I think I came across the GWT warnings that complain about using java.io.Serializable and the only work around that worked so far is when I used com.google.gwt.user.client.rpc.IsSerializable instead.

However, what I don't understand is that the client API still uses java.io.Serializable but GWT doesn't complain.

Revision history for this message
Scott Ritchie (sritchie) wrote :

The problem was (when i tried to fix it) Is that if you changed the value type to Serializable or IsSerializable, it would throw a warning at compile time that it couldnt find any class of that type - My interpretation of the error message was that it iterated over our class files looking for those marked with the Serializable/IsSerializable interface. So even if the students supplied their own Serializable class, it wouldnt work because it wouldnt be one of the Serializable/IsSerializable classes found at compile time.

Revision history for this message
Matt Giuca (mgiuca) wrote :

Is this a duplicate of bug #744035? I feel like we have had this discussion many times (on the mailing list). There wasn't really a good solution.

We can't use com.google.gwt.user.client.rpc.IsSerializable, as that doesn't work for primitive types and requires that the game developers implement that obscure interface. I thought I tried it with students supplying their own java.io.Serializable and that worked, despite the warning. I think it's just a performance issue.

See this Stack Overflow question I asked:
http://stackoverflow.com/questions/5538591/should-a-gwt-rpc-service-use-java-io-serializable-as-a-parameter-type

Revision history for this message
Prageeth Silva (prageethsilva) wrote :

@Scott: The way I interpreted was that, by that time, we had an annotation "serialize=true", and that is only valid for concrete classes. That's the reason you kept getting that error. Other than that, I really don't know the solution; the optimised solution rather.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.