Closed thomasAtToem closed 3 years ago
The code you have is not Closure style (or in general object-orient style of JS). That's why you are having so many errors from Closure compiler's checking.
Something like following should achieve what you are trying to accomplish.
goog.module('de.toem.toolkits.pattern.scripting.ScriptRunner');
const IPaint = goog.require('de.toem.impulse.paint.IPaint');
class ScriptRunner {
/**
* @param {string} symbol
* @param {?} object
*/
setSymbol(key, object) {
this[key]=object;
}
/**
* @param {string} script
* @return {?}
*/
run(script) {
return eval(script);
}
};
exports = ScriptRunner;
Hi,
i have the following java wrapper:
and this js implementation:
Its working in dev mode , but in release mode i get these errors in classes refererencing the runner. Can anybody help ? thanks, thomas
ERROR: /home/thomas/Workspaces/impulse/de.toem.impulse.html.frontend/build/src/main/java/app/BUILD:31:17: Compiling 12 JavaScript files to src/main/java/app/impulse.js failed: (Exit 1): ClosureWorker failed: error executing command bazel-out/host/bin/external/io_bazel_rules_closure/java/io/bazel/rules/closure/ClosureWorker @@bazel-out/k8-fastbuild/bin/src/main/java/app/impulse.js-0.params bazel-out/k8-fastbuild/bin/src/main/java/de/toem/toem.js.zip!/de/toem/toolkits/pattern/scripting/HtmlScripting.impl.java.js:51: Originally at: bazel-out/k8-fastbuild/bin/src/main/java/de/toem/toem.js.zip!/de/toem/toolkits/pattern/scripting/HtmlScripting.java:23: ERROR - cannot instantiate non-constructor ProTip: "JSC_NOT_A_CONSTRUCTOR" or "checkTypes" can be added to the
suppress
attribute of: //src/main/java/de/toem:toem Alternatively /* @suppress {checkTypes} / can be added to the source file.bazel-out/k8-fastbuild/bin/src/main/java/de/toem/toem.js.zip!/de/toem/toolkits/pattern/scripting/HtmlScripting.impl.java.js:54: Originally at: bazel-out/k8-fastbuild/bin/src/main/java/de/toem/toem.js.zip!/de/toem/toolkits/pattern/scripting/HtmlScripting.java:25: ERROR - Bad type annotation. Unknown type module$exports$de$toem$toolkits$pattern$scripting$ScriptRunner ProTip: "JSC_UNRECOGNIZED_TYPE_ERROR" or "checkTypes" or "unrecognizedTypeError" can be added to the
suppress
attribute of: //src/main/java/de/toem:toem Alternatively /* @suppress {checkTypes} / can be added to the source file.bazel-out/k8-fastbuild/bin/src/main/java/de/toem/toem.js.zip!/de/toem/toolkits/pattern/scripting/HtmlScripting.impl.java.js:59: Originally at: bazel-out/k8-fastbuild/bin/src/main/java/de/toem/toem.js.zip!/de/toem/toolkits/pattern/scripting/HtmlScripting.java:35: ERROR - Bad type annotation. Unknown type module$exports$de$toem$toolkits$pattern$scripting$ScriptRunner ProTip: "JSC_UNRECOGNIZED_TYPE_ERROR" or "checkTypes" or "unrecognizedTypeError" can be added to the
suppress
attribute of: //src/main/java/de/toem:toem Alternatively /* @suppress {checkTypes} / can be added to the source file.bazel-out/k8-fastbuild/bin/src/main/java/de/toem/toem.js.zip!/de/toem/toolkits/pattern/scripting/HtmlScripting.impl.java.js:68: Originally at: bazel-out/k8-fastbuild/bin/src/main/java/de/toem/toem.js.zip!/de/toem/toolkits/pattern/scripting/HtmlScripting.java:49: ERROR - Bad type annotation. Unknown type module$exports$de$toem$toolkits$pattern$scripting$ScriptRunner ProTip: "JSC_UNRECOGNIZED_TYPE_ERROR" or "checkTypes" or "unrecognizedTypeError" can be added to the
suppress
attribute of: //src/main/java/de/toem:toem Alternatively /* @suppress {checkTypes} / can be added to the source file.4 error(s), 0 warning(s), 98.6% typed