Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4238208
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:52:28+00:00 2026-05-21T02:52:28+00:00

I am defining a simple key-value store service in GWT; I will be writing

  • 0

I am defining a simple “key-value store” service in GWT; I will be writing the server but letting others write clients so it should be as simple as possible. I want the client to be able to use String keys, but values of any serializable type. So I defined the interface:

public void put(String key, java.io.Serializable value);
public java.io.Serializable get(String key);

This works perfectly, but there’s one problem: Eclipse gives the following warning on both methods:

Checking all subtypes of Object which qualify for serialization

Googling that warning, it seems like GWT is going to generate a piece of code for every single type in the program. Therefore, this could be quite expensive. I’m confused because I thought that all types in the Serializable interface already had serialisation code, and it could just call that (but perhaps that serialisation code is only generated in this case).

So I have a number of questions:

  • Is this going to make the client code much a) bigger and/or b) slower? How serious is that problem?
  • I see GWT provides a separate interface IsSerializable. Can I use that instead? I tried it but I noticed that basic classes like String and Integer do not implement this interface.
  • If I make the RPC layer use byte[] instead, but provide a wrapper method for my clients to serialize a java.io.Serializable into a byte[], will that get around the problem, or will it end up with the same code bloat problem I started with?
  • Is there a better way to implement a key-value store which allows arbitrary-type values without too much work on behalf of the client?
  • If I stick with Serializable, is there a way to suppress that warning?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:52:29+00:00Added an answer on May 21, 2026 at 2:52 am

    I see GWT provides a separate interface IsSerializable. Can I use that instead? I tried it but I noticed that basic classes like String and Integer do not implement this interface.

    Yes. IsSerializable is preferred over java.io.Serializable. The GWT FAQ lists the reasons why this is so:

    • The semantics of GWT’s serialization are much less sophisticated than standard Java serialization, and so to use java.io.Serializable as the marker interface would imply that GWT’s serialization system is capable of more than it actually is.
    • Conversely, GWT’s serialization mechanism is simpler than standard Java’s, and so to use java.io.Serializable would imply that users have more to worry about (such as serialization version IDs) than they actually do.
    • GWT implements only a subset of the full Java JRE classes, and specifically implements nothing in java.io. To use java.io.Serializable as the GWT RPC serialization marker interface dilutes the message that java.io is not usable within a GWT application.

    >

    If I make the RPC layer use byte[] instead, but provide a wrapper method for my clients to serialize a java.io.Serializable into a byte[], will that get around the problem, or will it end up with the same code bloat problem I started with?

    Bad idea. In this case, the serialization from objects to byte[] will happen in JavaScript on the client side. Yes, serialization is possible on the client side, but with the GWT protocol; that’s not Java serialization. The browser will not do that well.

    Is there a better way to implement a key-value store which allows arbitrary-type values without too much work on behalf of the client?

    Unfortunately, I think you will not be able to get away with one true method for all classes. I suggest you try the following interface:

    interface Store<T extends Serializable & IsSerializable> {
    void put(String key, String value);
    void put(String key, Number value);
    void put(String key, T value);
    
    Integer getInt(String key);
    Double getDouble(String key);
    BigDecimal getBigDecimal(String key);
    String getString(String key);
    IsSerializable get(String key);
    }
    

    The generics ensure that the object has both interfaces, so that you can serialize then both with the GWT protocol (from client to server) and Java serialization (from server to data store).

    Edit Answering comments:

    With that last solution, doesn’t the generic mean the store can only store a single type of object, and if the client wants to store a different one, he has to create a new store?

    Yes, the client would have to create a new store for each type. If it really bothers you, A solution around this is to create a new interface MySerializable, which extends IsSerializable and java.io.Serializable; but then each object will have to implement that, which creates a dependency on your project.

    Also doesn’t it require that the object is both Serializable and IsSerializable?

    Yes, and that’s a benefit. Otherwise, you risk having an object on the server side that is not java.io.Serializable; if you try to supply it to method ObjectOutputStream#writeObject, an exception will blow up at your face.

    Lastly, what about my first question: is just using io.Serializable actually going to affect the code size / performance?

    I cannot say that from real usage, but I don’t think so: both are simply marker interfaces. The GWT serialization will be the same for either.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When defining simple DataMapper resource, it sets default storage engine to InnoDB, but I
Here is a simple code of defining an array. I noticed this code will
Atleast defining my problem is simple... I have a Input control (Text) and a
Defining custom components in Facelets is easy and quick but there's one thing I
I am interested in defining a key constraint in my Xsd. It is my
Defining simple getters and setters is easy using Asm (and fortunately it is even
I am having trouble defining and automating my build process despite simple requirements: Every
I can't figure out how to do such a simple thing like defining constants
I have a small program to demonstrate simple inheritance. I am defining a Dog
I'm currently trying to create a PHP Thrift server which will be accessed by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.