Is the data that flows in the lambda an object created by your Java applications or does it flow from JavaScript?
On Mon, Oct 26, 2015 at 1:48 PM, 'Ray Cromwell' via GWT Contributors < [email protected]> wrote: > It looks to me like it might be a type inferencing issue Roberto. > Remember, the lambda is matched to a SAM interface method. When it > synthesizes the implementation, it takes info from JDT about the 'expected > type' which is inferred by JDT. I wonder if the type inferred messes up > type tightener somehow. Here's something to try, put your lambda into a > local var; > > e.g. > > Function<Foo, Bar> foo = {data -> data.getAccount() etc} > service.get().getBootstrap().bootstrap().doOnNext(foo) > > That way you force the param types to what you know they are. > > I suppose another thing to try is to declare a type > > service.get().getBootstrap().bootstrap().doOnNext(Data data -> .....) > > What I'm suspecting is that the compiler is seeing a different type for > the parameter somehow and inferring it is never instantiated. > > > > On Mon, Oct 26, 2015 at 12:57 PM, Ignacio Baca Moreno-Torres < > [email protected]> wrote: > >> I said that optimize=0 fix errors, but I just compiled the project a get >> the same bootstrap+lamba error. But with draftCompile the result looks ok. >> // bootstrap case, lambda, pretty, draftCompile >> _.lambda$5 = function lambda$5(data_0){ >> $clinit_ApplicationBootstrapper(); >> var account, user; >> { >> account = getAccount__Lshared_user_Account___devirtual$(data_0); >> if (isNull_2(account)) >> castTo(this.auth.get_1(), 242).resetSessionData(false); >> else >> castTo(this.auth.get_1(), 242).setSessionData(account, >> getKeychain__LKeychain___devirtual$(data_0)); >> >> castTo(this.theme.get_1(), 951).setCustomization( >> getCustomization__LCustomization___devirtual$(data_0)); >> castTo(this.analytics.get_1(),7570).init_13( >> getAnalyticsUserAccount__Ljava_lang_String___devirtual$(data_0) + >> ':' + >> getAnalyticsDomainName__Ljava_lang_String___devirtual$(data_0)); >> configureServer( >> getReverseGeocodingUrl__Ljava_lang_String___devirtual$(data_0)); >> user = isNull_2(account)?'anonymous': >> getEmail__Ljava_lang_String___devirtual$(account); >> log_10.fine('Bootstrap data loaded successfully (user=' + user + ')' >> ); >> } >> }; >> defineClass(1672, 1, {1:1}, ApplicationBootstrapper$lambda$5$Type); >> _.call_0 = function call_3(arg0){ >> this.$$outer_0.lambda$5(arg0); >> }; >> var Lclient_ApplicationBootstrapper$lambda$5$Type_2_classLit = >> createForClass('client', 'ApplicationBootstrapper/lambda$5$Type', 1672, >> Ljava_lang_Object_2_classLit); >> >> >> >> On Monday, October 26, 2015 at 8:27:41 PM UTC+1, Ignacio Baca >> Moreno-Torres wrote: >> >>> Bootstrap using lambda (fail) >>> >>> // java >>> 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 + ")"); >>> }); >>> // javascript + pretty >>> function $lambda$5(this$static) { >>> var lastArg; >>> null .$_nullMethod(); >>> $resetSessionData(castTo(this$static.auth.get_1(), 400), false); >>> $setCustomization((lastArg = castTo(this$static.theme.get_1(), 1067 >>> ), >>> null .$_nullMethod(), >>> lastArg)); >>> castTo(this$static.analytics.get_1(), 6137).init_2(null . >>> $_nullMethod() + ':' + null .$_nullMethod()); >>> configureServer(null .$_nullMethod()); >>> $fine_0(log_3, 'Bootstrap data loaded successfully (user=anonymous)' >>> ); >>> } >>> >>> >>> ProcessResponse using anonymous class (success). >>> >>> // java >>> tracker.add(heads.subscribe(new Action1<SubscriptionResponse>() { >>> @Override public void call(SubscriptionResponse response) { >>> ClientTelemetryStore.this.processResponse(response); >>> } >>> })); >>> // Javascript >>> defineClass(2064, 1, {}, ClientTelemetryStore$1); >>> _.call_0 = function call_145(response) { >>> $call_3(this, castToAllowJso(response, 6180)); >>> }; >>> function $call_3(this$static, response) { >>> $processResponse(this$static.this$01, response); >>> } >>> function $processResponse(this$static, response) { >>> var newUnits, xs, xs$iterator, xs$iterator0; >>> requireNonNull_0(response, 'response required'); >>> requireNonNull_0(response.uuid, 'response.uuid required’); >>> >>> >>> ProcessResponse using lambda (fail). >>> >>> // Java >>> tracker.add(heads.subscribe(response -> { ClientTelemetryStore.this. >>> processResponse(response); })); >>> // Javascript >>> defineClass(2063, 1, {}, ClientTelemetryStore$lambda$3$Type); >>> _.call_0 = function call_153(arg0) { >>> $processResponse(this.$$outer_0, throwClassCastExceptionUnlessNull( >>> arg0)); >>> }; >>> function $processResponse(this$static, response) { >>> var newUnits, xs, xs$iterator, xs$iterator0; >>> requireNonNull_0(response, 'response required'); >>> requireNonNull_0(null .$_nullMethod(), 'response.uuid required'); >>> >>> I did not use pretty style because I thought that this flag produces >>> different result, I tested now and looks like the output is the same, but, >>> I'm pretty sure that some flags changes this issues, optimize is obvious >>> that fixes the problem, but I think that namespace=package also changes the >>> result. >>> >>> I know that this was easier if we have a sample project, but I can't >>> reproduce! :( You can try, the ResourceRegistry case is plain java + guava. >>> But when you copy to a clean project, the bug disappear. >>> this.store = Suppliers.memoize(() -> from(resources.get()).uniqueIndex( >>> ResourceDescriptor::getType)); >>> Resource descriptor is an interface with only one implementation where >>> type is a Class<?> type field, a getType return this field. Anyway, I'm >>> still trying to reproduce in a small project. >>> >>> On Monday, October 26, 2015 at 5:26:33 PM UTC+1, Roberto Lublinerman >>> wrote: >>> >>> Also could you try the equivalent lamda that is not a method reference, >>> i.e >>> >>> (parameters) -> this.processResponse(params); >>> >>> I looked at the way we construct the innerclasses corresponding to >>> lambdas and it looks ok. >>> >>> It would really help if you could narrow it down to a small reprocase >>> that I can run. >>> >>> On Sun, Oct 25, 2015 at 5:23 AM, Ignacio Baca Moreno-Torres < >>> [email protected]> wrote: >>> >>> function ILe(a) { >>> var b; >>> b = Erb(PDl(a.a, 'REFXXX store'), 164); >>> Erb(PDl(Erb(b.De(), 82), 'REFXXX store.get()'), 82); >>> return Erb(PDl(undefined, 'REFXXX store.get().values()'), 6) >>> >>> ... >> >> -- >> 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/168ed0d1-7abe-4f9f-b5e2-e238dd72e329%40googlegroups.com >> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/168ed0d1-7abe-4f9f-b5e2-e238dd72e329%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/CAPVRV7fRHJTUR4zFswOC82S%3DmH-%3DGdD3fCdFXBFVbRzbgLYE6g%40mail.gmail.com > <https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAPVRV7fRHJTUR4zFswOC82S%3DmH-%3DGdD3fCdFXBFVbRzbgLYE6g%40mail.gmail.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/CAC7T7gkNLgwjpTWx1-O-%2BdXqFL6KY5ZYXHPssUtwj-xSkwiJ9g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
