Skip to content

Commit

Permalink
[MultiLang #672] Review comments fix: Java script stub generation iss…
Browse files Browse the repository at this point in the history
…ue fix after migrating to GraalVM RC14
  • Loading branch information
maheshrajus committed Apr 26, 2019
1 parent 1f6e71c commit 5320d36
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ private String generateFunctions() {
// TODO: this is workaround for the issue:https://github.com/oracle/graal/issues/678.
// This will be deleted once the above issue is fixed.
// TODO: For js files, the function "GetMemberKeys" should implement and it should return
// all functions inside the class. Otherwise it will not generate stub class with methods.
// all functions inside the class.
if (lang.equals("js")) {
Value val = prototype.getMember("GetMemberKeys");
if (val != null) {
Expand All @@ -335,6 +335,10 @@ private String generateFunctions() {
convertFunctionName);
res.append(function);
}
} else {
logger.log(
Level.SEVERE,
String.format(" %s.js should have GetMemberKeys function", className));
}
}

Expand Down
7 changes: 1 addition & 6 deletions examples/kvstorejs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ task runjsapp(type: Exec) {
"${project.projectDir}/src/main/js/amino/run/appdemo/KeyValueStoreClient.js"
}

// TODO: Re-enable runapp as soon as https://github.com/oracle/graal/issues/678 has been fixed.
// The above bug in graal means that our graalStubGenerator does not correctly generate java
// stubs for javascript microservices (the methods in the javascript object are missing).
// TODO: currently we implemented "GetMemberKeys" method in each JS file which will return all functions in that class.This will remove once the above issue closed.

// Customise task to run Java app
// Customise task to un Java app
runapp {
environment OMS_IP: "${project.property('omsIp')}"
environment OMS_PORT: "${project.property('omsPort')}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ class KeyValueStore {
return this.map.has(key);
}

//TODO: this is workaround for the issue:https://github.com/oracle/graal/issues/678. This will be deleted once the above issue is fixed.
//TODO: This is workaround for the issue: https://github.com/oracle/graal/issues/678.
//This will be deleted once the above issue is fixed.
//It will return all functions in this class except constructor.
GetMemberKeys() {
let obj = new KeyValueStore();
let methods = [];
while (obj = Reflect.getPrototypeOf(obj)) {
if ((Object.getPrototypeOf(obj)) && obj != Object.prototype) {
//the below condition is used to avoid 'Object' functions like "toString,isPrototypeOf,propertyIsEnumerable,toLocaleString" etc
if (obj != Object.prototype) {
let keys = Reflect.ownKeys(obj)
keys.forEach((k) => {
if (k !== "constructor") {
Expand Down

0 comments on commit 5320d36

Please sign in to comment.