Hi

How can I add constants to a native @JsType?

I was trying to add support for constants to my WebIDL to JsInterop 
generator but I have a problem with constants.

Here is a snippet of the definition of Node


[Exposed=Window]
interface Node : EventTarget {
  const unsigned short ELEMENT_NODE = 1;
  const unsigned short ATTRIBUTE_NODE = 2; // historical
  const unsigned short TEXT_NODE = 3;
  ...
  readonly attribute unsigned short nodeType;
  readonly attribute DOMString nodeName;


And here is the corresponding Java that I generate


@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public interface Node extends EventTarget {
  public static final short ELEMENT_NODE = 1;
  public static final short ATTRIBUTE_NODE = 2;
  public static final short TEXT_NODE = 3;
  ...
  @JsProperty(name = "nodeType") short getNodeType();
  @JsProperty(name = "nodeName") String getNodeName();


But GWT complains about it

[ERROR] Line 10: Native JsType field 'short Node.ELEMENT_NODE' cannot have 
initializer.

I tried adding @JsIgnore to the fields but was also illegal

Best regards
Rene

-- 
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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to