One of the tips for preventing code removal by the compiler is the use of reflect.sinkValue from closure-library. Is it possible to use this feature without resorting to creating native.js?
lets say I have something like this:
public class Test {
Random random = new Random();
private void test() {
DomGlobal.console.log("test " + random.nextInt(10) + this.getClass().getCanonicalName());
}
}
And I want to call it like this:
Test test = new Test();
((Function)Js.asPropertyMap(test).get(objectProperty("m_test___$p_org_treblereel_Test", test))).bind(test).call();
// it works for non inlined/removed functions
@JsMethod(namespace = "goog.reflect")
public native static String objectProperty(String property, Object object);
What should I pass to sinkValue wrapper?
@JsMethod(namespace = "goog.reflect")
public native static Object sinkValue(??? value);
As I can see from the docs I should use something like sinkValue(test.m_test___$p_org_treblereel_Test) but it's not possible from java.
One of the tips for preventing code removal by the compiler is the use of reflect.sinkValue from closure-library. Is it possible to use this feature without resorting to creating native.js?
lets say I have something like this:
And I want to call it like this:
What should I pass to sinkValue wrapper?
As I can see from the docs I should use something like
sinkValue(test.m_test___$p_org_treblereel_Test)but it's not possible from java.