I am interesting in GWT implementation JRE libraries emulation technology.
How GWT emulate Java library?
How effectively implemented HashMap in JavaScript? Is it implemented in pure JavaScript or it is compile as Java source if used in code?
I understand some implementation exists in gwt-dev library for development(hosted) mode. Is it same implementation for production code?
You can browse the code online, e.g. HashMap, or more interestingly AbstractHashMap. As you can see, there are some JSNI methods (the ones with the
nativekeyword, and the/*-{ ... }-*/syntax). But many methods in the emulation code build on top of the JSNI methods: They are written as “higher level” Java methods.This emulation code is really simply GWT code as you would write your own (but of course the percentage of JSNI code is higher, statistically). And it uses the
<super-source>mechanism: This way, the client code for the same class can be different in production mode compared to development mode.