17 ms·
The comments on jsinterop with respect to GWT are stale, GWT has a rich non-JSNI based JsInterop system now, as well as a generator that can read Closure and Ty
by cromwellian 10y ago
The comments on jsinterop with respect to GWT are stale, GWT has a rich non-JSNI based JsInterop system now, as well as a generator that can read Closure and Typescript files and produce typed Java interfaces and classes for calling external JS. It even converts Java8 lambdas directly into JS functions and the reverse.
Also, the design restrictions to ban runtime reflection in GWT are a codesize decision. Allowing reflective calls basically inhibits optimization and forces the retention of tons of metadata.
The Deferred Binding mechanism is essentially dependency injection before DI and annotation processing existed, because GWT hails from 2007. We now recommend using Dagger2 for DI, and Annotation Processors for code generators, so that the system of compile time reflective calls is all part of the standard tool chain.
In the era of mobile browsers, I think 100k is a bridge too far for a hello world, especially in the developing world, so restrictions to the JRE runtime which allow much greater code pruning are a necessary evil. It hasn't really prevented an enormous amount of code sharing.
For example, Google Inbox shares 70% of its Java code between Web, Android, and iOS (via J2Objc)