Does it still happen if you use an anonymous inner class instead of a lambda?
On Sat, Oct 24, 2015 at 4:54 AM, Ignacio Baca Moreno-Torres < [email protected]> wrote: > Other situation producing the same problem. If next code is replaced by > lambda and method reference... the next block end up being optimized as if > response is always null. > > //noinspection Convert2Lambda,Anonymous2MethodRef IGP-1732 gwt optimize > incompatible > tracker.add(heads.subscribe(new Action1<SubscriptionResponse>() { > @Override public void call(SubscriptionResponse response) { > ClientTelemetryStore.this.processResponse(response); > } > })); > > The processResponse java code. > > private void processResponse(SubscriptionResponse response) { > Objects.requireNonNull(response, "response required"); > Objects.requireNonNull(response.getUuid(), "response.uuid required"); > if (uuid == null) uuid = response.getUuid(); // first response > else assert uuid.equals(response.getUuid()) : "subscription uuid > mismatch"; > boolean newUnits = false; > for (UnitDescriptor xs : response.getUnits()) { > newUnits |= processUnitCreate(xs); > } > for (ProtoUnit xs : response.getData()) { > processUnitUpdate(xs); > } > // accumulate change updates per response > if (newUnits) tStoresChange.onNext(tStores); > } > > And processResponse js code. > function Hak(a, b) { > var c, d, e, f; > lWl(b, 'response required'); > lWl(null ._0(), 'response.uuid required'); > a.g = null ._0(); > c = false; > for (f = null ._0()._0(); f.Nd(); ) { > d = Vub(f.Od()); > c = c | Iak(a, d) > } > for (e = null ._0()._0(); e.Nd(); ) { > d = Uub(e.Od(), 6163); > Jak(a, d) > } > c && lrm(a.d, a.c) > } > > On Saturday, October 24, 2015 at 1:40:24 PM UTC+2, Ignacio Baca > Moreno-Torres wrote: >> >> There is a bug which optimizations nullify variables which might not be >> null. I'm trying to reproduce the error outside our app but I can't, I'll >> continue trying, but for now I going to describe the problem. >> >> return service.get().getBootstrap().bootstrap().doOnNext(data -> { >> Account account = data.getAccount(); >> if (account == null) auth.get().resetSessionData(false); >> else auth.get().setSessionData(account, data.getKeychain()); >> theme.get().setCustomization(data.getCustomization()); >> analytics.get().init(data.getAnalyticsUserAccount() + ":" + >> data.getAnalyticsDomainName()); >> OsmQueryResolver.configureServer(data.getReverseGeocodingUrl()); >> final String user = account == null ? "anonymous" : account.getEmail(); >> log.fine("Bootstrap data loaded successfully (user=" + user + ")"); >> }); >> >> Produces the next js code. >> function fie(a) { >> var b; >> null .b1(); >> bdf(Tub(a.b.Ee(), 388), false); >> Ujf((b = Tub(a.k.Ee(), 937), >> null .b1(), >> b)); >> Tub(a.a.Ee(), 6122).VI(null .b1() + ':' + null .b1()); >> Ivg(null .b1()); >> U_l(cie, 'Bootstrap data loaded successfully (user=anonymous)') >> } >> BUT! if compile without optimizations (ex. using draft compile) or if >> anonymous class is used instead of a lambda, the output js is ok. Next >> block contains my current working code. >> >> //noinspection Convert2Lambda GWT optimize incompatible >> return service.get().getBootstrap().bootstrap().doOnNext(new >> Action1<EntryPointData>() { >> @Override public void call(EntryPointData data) { >> >> >> The bootstrap method is a call of reactive restygwt service using this >> proyect https://github.com/ibaca/restygwt-rxadapter. I.e. bootstrap >> return an Observable which end up making a XMLHttpRequest (a lot of layer >> in between), and data is a EntryPoint interface, and the implementation >> received is an overlay. >> >> I know that with this info is almost impossible to discover the problem, >> but I put here to see if someone else have similar problem, and maybe some >> gwt compiler developer just seeing that may see where is the problem >> (improbable). If a get reproduced in a sample project I write back here. >> > -- > You received this message because you are subscribed to the Google Groups > "GWT Contributors" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-web-toolkit-contributors/9dd3316c-68f5-4ed9-8d8c-c7a34f123109%40googlegroups.com > <https://groups.google.com/d/msgid/google-web-toolkit-contributors/9dd3316c-68f5-4ed9-8d8c-c7a34f123109%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "GWT Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAPVRV7eeyyU54B5UQJpk-DKyeTTHxaUrnmZrE-HM32eXP-u1Bg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
