Let me try: without -generateJsInteropExports, GWT acts as if @JsType(isNative=false) wasn't there at all. Why'd you want this?
- when @JsType(isNative=false) is applied to types you didn't write yourself (third-party). For example, java.util.Collection, java.util.List, java.util.Map, java.util.Set, and java.lang.Enum are annotated with @JsType. If you don't use -generateJsInteropExports, their non-@JsIgnoreâ‹…d public members won't be renamed, and the @JsProperty and @JsMethod-specified names won't be honored, so you'll have very short (obfuscated) names in your app. If you use -generateJsInteropExports, the given js-names will be honored and your code will be slightly bigger, but then you can pass a java.util.List to JS and you can call getAtIndex and removeAtIndex (for example) on it from JS code. - when you want to possibly export your project as a standalone JS lib, but have it consumable by GWT apps with all the GWT optimization goodness: your types will be annotated with @JsType, apps that use your GWT library without using -generateJsInteropExports will have highly-optimized code; but you can use -generateJsInteropExports to export your annotated types to create a standalone JS lib. GWT apps consuming your GWT library and using -generateJsInteropExports will pay the price for your @JsType though (see example above about java.util.List), so you'll probably want to separate out some of your code into a project specific to exporting your JS lib (similarly to how GWTUpload/JSUpload did it) That was Jens' example. On Thursday, September 15, 2016 at 10:18:55 AM UTC+2, Vassilis Virvilis wrote: > > Jens sorry - one more round if you please > > > The library exists as GWT library (*.jar file with *.gwt.xml)... > > This GWT library is source right? That means it is compiled by the > compilation session of MyApplication right? > > Unless.... (light bulb goes on) > > In some cases you want the library to act as JS library for one Page but > for another page you only plan to link it with the GWT MyApplication (and > not export is as a JS library) where normal optimization techniques apply. > > Is that it? If so tricky... > > > Vassilis > > > > > > > On Thu, Sep 15, 2016 at 1:54 AM, Jens wrote: > >> >> Is this GWT library exported as JS only? ... >>> >> So I don't get it. What am I missing? >>> >> >> The library exists as GWT library (*.jar file with *.gwt.xml) so you can >> use it right away in your GWT app, but the library is also exported by the >> library maintainer to JavaScript so that JavaScript people can also use it >> right away by including a *.js file. >> >> In that case your app does not want to use -generateJsInteropExports >> because it directly uses the GWT library which has @JsType(isNative = >> false) all over the place in its Java files. If you would use >> -generateJsInteropExport in your app, it would have a negative impact on >> your code size because these @JsType classes would not be optimized/pruned >> then. Now imagine you have several of such libraries in your app. >> >> -- J. >> >> > > > > -- > Vassilis Virvilis > -- You received this message because you are subscribed to the Google Groups "GWT Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
