Wednesday, November 2, 2016

SafeHtml as return for com.google.gwt.i18n.client.Messages and GET 2.8

Hi,

I have changed the return type from String to SafeHtml in my resources and take unexpected behavior - "not a function" in log

So original code 

@DefaultLocale("en")
public interface ComplexText extends Messages {

       @Nonnull
    @DefaultMessage("Employees")
    String employees();
}


Updated code

@DefaultLocale("en")
public interface ComplexText extends Messages {

       @Nonnull
    @DefaultMessage("Employees")
    SafeHtml employees();

}

error in log after change:

ConsoleLogger.java:32TypeError: ($clinit_FtModuleRs_0_g$(...) , TXT_1_g$).employees_33_g$ is not a function
    at ServiceColumnModel_1_g$.configureColumns_13_g$ [as configureColumns_21_g$] (ServiceColumnModel.java:43)
    at ServiceColumnModel_1_g$.configureColumns_14_g$ [as configureColumns_19_g$] (ServiceColumnModel.java:36)
    at ServiceColumnModel_1_g$.CrudColumnModel_1_g$ (CrudColumnModel.java:15)
    at ServiceColumnModel_1_g$ (ServiceColumnModel.java:31)
    at com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment_89_g$.com$jresearchsoft$booking$ft$admin$module$client$service$widget$ServiceColumnModel_com$jresearchsoft$booking$ft$admin$module$client$service$widget$ServiceColumnModel_methodInjection_0_g$ [as com$jresearchsoft$booking$ft$admin$module$client$service$widget$ServiceColumnModel_com$jresearchsoft$booking$ft$admin$module$client$service$widget$ServiceColumnModel_methodInjection_1_g$] (com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment.j…:98)
    at com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment_89_g$.get_Key$type$com$jresearchsoft$booking$ft$admin$module$client$service$widget$ServiceColumnModel$_annotation$$none$$_0_g$ [as get_Key$type$com$jresearchsoft$booking$ft$admin$module$client$service$widget$ServiceColumnModel$_annotation$$none$$_1_g$] (com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment.j…:88)
    at com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment_89_g$.get_Key$type$com$jresearchsoft$booking$ft$admin$module$client$service$widget$ServiceGrid$_annotation$$none$$_0_g$ [as get_Key$type$com$jresearchsoft$booking$ft$admin$module$client$service$widget$ServiceGrid$_annotation$$none$$_1_g$] (com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment.j…:106)
    at com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment_89_g$.get_Key$type$com$jresearchsoft$booking$ft$admin$module$client$service$widget$ServiceListPanel$_annotation$$none$$_0_g$ [as get_Key$type$com$jresearchsoft$booking$ft$admin$module$client$service$widget$ServiceListPanel$_annotation$$none$$_1_g$] (com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment.j…:124)
    at com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment_87_g$.get_Key$type$com$jresearchsoft$booking$ft$admin$module$client$service$mvc$ServiceView$_annotation$$none$$_0_g$ [as get_Key$type$com$jresearchsoft$booking$ft$admin$module$client$service$mvc$ServiceView$_annotation$$none$$_1_g$] (com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment.j…:44)
    at com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment$1$1_21_g$.onSuccess_117_g$ [as onSuccess_172_g$] (com_jresearchsoft_booking_ft_admin_app_client_gin_AdminGinjector_AdminGinjectorGinjector_fragment.j…:67)
    at GWT$1_1_g$.execute_6_g$ [as execute_205_g$] (GWT.java:282)
    at $executeScheduled_0_g$ (SchedulerImpl.java:50)
    at runScheduledTasks_0_g$ (SchedulerImpl.java:183)
    at SchedulerImpl_1_g$.flushPostEventPumpCommands_0_g$ [as flushPostEventPumpCommands_1_g$] (SchedulerImpl.java:347)
    at SchedulerImpl$Flusher_1_g$.execute_10_g$ [as execute_206_g$] (SchedulerImpl.java:78)
    at execute_9_g$ (SchedulerImpl.java:141)
    at apply_50_g$ (Impl.java:239)
    at entry0_0_g$ (Impl.java:291)
    at Impl.java:77
    at callback_0_g$ (SchedulerImpl.java:196)

My guess is the GWT compiler incorrectly recognizes a SafeHtml parameter as a functional interface.

Best,
Stas

--
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment