Tuesday, August 22, 2017

Re: GWT 2.6.1 BigInteger

W dniu 21.08.2017 o 02:05, Thomas Broyer pisze:


On Monday, August 21, 2017 at 1:13:42 AM UTC+2, Łukasz Bączek wrote:
W dniu 21.08.2017 o 00:27, Thomas Broyer pisze:
>
> Like in any Java environment, as long as you only use the part of the
> API that's emulated in GWT:
> http://www.gwtproject.org/doc/latest/RefJreEmulation.html#Package_java_math
>
Yes, it just does not work

com.google.gwt.user.client.rpc.SerializationException: Type
'java.math.BigInteger' was not included in the set of types which can be
serialized by this SerializationPolicy or its Class object could not be
loaded. For security purposes, this type will not be serialized.:
instance = 123
     at
com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:667)
     at
com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)
     at
com.google.gwt.user.client.rpc.core.java.util.Map_CustomFieldSerializerBase.serialize(Map_CustomFieldSerializerBase.java:53)
     at
com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.serialize(HashMap_CustomFieldSerializer.java:39)
     at
com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.serializeInstance(HashMap_CustomFieldSerializer.java:51)
     at
com.google.gwt.user.client.rpc.core.java.util.HashMap_CustomFieldSerializer.serializeInstance(HashMap_CustomFieldSerializer.java:28)

Oh, so this is about use with GWT-RPC then, not BigInteger by itself.
Can you show your code that fails?
Hello,
The information helped me:
Make sure your generics at least implement some interface and you'll be good to go;
the compiler then sees the classes that need to be on the whitelist, as they are referenced
in the RPC method (references via this interface)

(e.g. instead of  HashMap<String,Object>, use HashMap<String,MyInterface>)

Found here: https://github.com/gwtproject/gwt/issues/5810

No comments:

Post a Comment