gwtcompilationcompilationunit

GWT compiler - compilation units and interfaces


This question is based on an answer I received for another question : https://stackoverflow.com/a/3060233/323357

My understanding is that the use of interfaces to declare return types and parameters types in my services forces the compiler to generate multiple compilation units, which increase my compile time and the size of generated files.

I don't think this is the case, but does the latest versions of gwt compiler (2.4 - 2.5) have a way to detect unnecessary compilation units...


Solution

  • Don't worry about the first 3 of your 4 examples. Usage of interfaces (or classes with many subclasses) on the client side has no cost: Unnecessary classes can be detected easily by analyzing which classes are ever instantiated. If in doubt, examine a compile report.

    However, this is impossible in GWT-RPC for server side calls: The client has no way to know, which instances the server will create. Consider that

    The only ways this code size overhead can ever be eliminated, are to either