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 9142021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:43:20+00:00 2026-06-17T09:43:20+00:00

There are already a few questions regarding the fact that methods in GWT RPC

  • 0

There are already a few questions regarding the fact that methods in GWT RPC should not return an interface like List, but rather a concrete class like ArrayList, because otherwise “GWT needs to include all possible implementations”. See e.g. In GWT, why shouldn't a method return an interface?

Here’s my question: is this limited to the return type itself? How about parameters of the method? And what if the return object contains an interface, e.g.

public class MyReturnObject implements IsSerializable {
   List<String> listOfUnspecifiedType1;
   List<Long> listOfUnspecifiedType2;
   ...
}

The examples I have seen all talk of the return type itself. I don’t see why it would be a problem to return an interface, but not a problem to return an object which just wraps an interface; but maybe I am missing something?

  • 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-06-17T09:43:21+00:00Added an answer on June 17, 2026 at 9:43 am

    It’s clear from the linked question that it applies recursively (and as soon as you understand why you should use the most derived types as possible, it becomes obvious that it is recursive).

    This is also true of method arguments, not only the return types and their fields: if you send a List<X> then GWT has to generate serialization code for all List classes: ArrayList, LinkedList, etc.

    And of course the same applies to classes, not only interfaces: AbstractList is no different from List.

    And because generation comes before optimization, all possible classes from the source path will be included, not only those that you use in your code; and then they come in the way of the optimization pass, as all those classes are now used by your app.

    Therefore, the rule is: use the most specific types as possible. The corollary is: don’t fear DTOs, don’t try to send your business/domain objects at all cost.

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

Sidebar

Related Questions

I know there are a few questions on stack already regarding this, and I
I know there are already a few questions like this but I can't seem
I know there are already a few questions regarding recommendations for C++ unit test
There are a few questions on SO already regarding LINQ pivots and while a
I realise there are a fair few questions on here already with regard to
There are already a couple of questions on finding cycles, but I did not
There were already a few similar questions on stackoverflow, but I haven't found the
I know there are multiple questions here on SO regarding this same issue already
I know there are very few questions already posted on this thing. I filtered
I know there are quite a few questions on this already and i've looked

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.