Actually HashMap and many of the Collections classes /are/ used in that simple bit on code.
The Widget classes and Event management make heavy use of the Collections classes. RootPanel alone uses a HashMap, and HashSet (which in turn use AbstractSet, etc.), RootPanel also uses the Window class with uses ArrayList and Collections. So basically by using RootPanel.get().add() you've effectively made use of a large chunk of the Collections classes, parts of the Event system, etc. The compiler is fairly good at removing unused code, but theres only so far it can go. The fact is: in a fairly complex GWT application you're likely to be using that code anyways. I assume you're compressing your compiled code before shipping it out to the browser, and setting the cache headers correctly, since once the user has the code (the .cache.* files) they never need to download them again (the name will change if the content of the file is changed). Hope that explains the behavior a bit ;) // J Vitali Lovich wrote: > The GWT compiler is supposed to remove all unused code. If you believe > that there's code in there that is unused, or can be removed, I would > recommend filing a bug. Hopefully a GWT developer would be able to > provide more information about this particular question. > > On Sun, Apr 26, 2009 at 5:03 PM, zbo <[email protected] > <mailto:[email protected]>> wrote: > > > Hello, > > I am working on reducing the compiled js size of a relatively > complex GWT application. I've been looking at the detailed output of > the compile process, and find quite a few blocks of code that seem to > be included no matter what. To test things and get a better > understanding of the GWT compile process, I build a trivial GWT app: > > onModuleLoad() { > RootPanel.get().add(new Label("placeholder"); > } > > Detailed output of this app was approximately 105k in size, and > filled with code I would expect (management of GWTEvents, onLoad > methods, String handling, etc) but also a lot of code that I wouldn't > expect (Hashmap, HashSet, AbstractSet, Set, Collections, etc.) My > question - is this entirely necessary, and if not, how do I avoid > having all of this code included a final compile of a real app? > > -Z > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
