On Tuesday, September 27, 2016 at 11:03:17 AM UTC+2, Kirill Prazdnikov wrote:
Hi,It is not clear why GWT disallow scalar and String constants in JsInterop interfaces
Previously it waspublic final class MediaError extends JavaScriptObject {
public static final int MEDIA_ERR_ABORTED = 1;Now it is impossible to declare the constant in the API declaration:@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public interface MediaError {
@JsProperty int getCode();int MEDIA_ERR_ABORTED = 1;}[ERROR] Line 11: Native JsType field 'int MediaError.MEDIA_ERR_ABORTED' cannot have initializer.
How can I add the constants ?
How can I enable scalar constants in @JsType interfaces ?
AIUI, either you map a JS constant to Java, and then you shouldn't use an initializer (but then you cannot use an interface); or you want a Java-only field in that interface (like you had in your JSO previously), and then you need to use @JsOverlay.
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