You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This seems to be a fairly recent change. As an example, to expose JS static fields on a class:
@JsType(isNative = true, name = "Object", namespace = JsPackage.GLOBAL)
public class Node extends JavaScriptObject {
/**
* The node is an {@link Element}.
*/
@JsProperty(namespace = "Node")
public static short ELEMENT_NODE;
References to these end up being compiled to $synthetic__Node.ELEMENT_NODE, where $synthetic__Node is defined as
let $synthetic__Node = goog.forwardDeclare('Node');
This way of referencing the native Node type seems to be an error in closure-compiler's ADVANCED mode:
Element$$Overlay.impl.java.js:5: ERROR - Imported Closure namespace "Node" never defined.
If this is a deliberate breaking change, it seems easy enough to work around, if a bit ugly, by moving the namespace to the name, and repeating the field's java name in the string:
@JsProperty(namespace = JsPackage.GLOBAL, name = "Node.ELEMENT_NODE")
public static short ELEMENT_NODE;
This results in the expected compiled JS: Node.ELEMENT_NODE.
The text was updated successfully, but these errors were encountered:
This was a deliberate change.
Roberto fixed a compiler bug which was treating namespace of properties/methods without . as something under GLOBAL namespace.
This seems to be a fairly recent change. As an example, to expose JS static fields on a class:
References to these end up being compiled to
$synthetic__Node.ELEMENT_NODE
, where$synthetic__Node
is defined asThis way of referencing the native Node type seems to be an error in closure-compiler's ADVANCED mode:
If this is a deliberate breaking change, it seems easy enough to work around, if a bit ugly, by moving the namespace to the name, and repeating the field's java name in the string:
This results in the expected compiled JS:
Node.ELEMENT_NODE
.The text was updated successfully, but these errors were encountered: