diff --git a/runtime/bicavm/browser/Window.class b/runtime/bicavm/browser/Window.class new file mode 100644 index 0000000..158f79c Binary files /dev/null and b/runtime/bicavm/browser/Window.class differ diff --git a/runtime/bicavm/browser/Window.java b/runtime/bicavm/browser/Window.java new file mode 100644 index 0000000..2e807e7 --- /dev/null +++ b/runtime/bicavm/browser/Window.java @@ -0,0 +1,5 @@ +package bicavm.browser; + +public class Window{ + public static native void setTitle(String title); +} \ No newline at end of file diff --git a/runtime/foo.class b/runtime/foo.class index c396eee..9a86a91 100644 Binary files a/runtime/foo.class and b/runtime/foo.class differ diff --git a/runtime/foo.java b/runtime/foo.java index 1473dc3..396ee37 100644 --- a/runtime/foo.java +++ b/runtime/foo.java @@ -4,7 +4,7 @@ import bicavm.browser.Window; public class foo{ public static void main(String[] args){ String hello = "bicavm"; - String world = "changed this title"; + String world = " changed this title"; Window.setTitle(hello + world); } } \ No newline at end of file diff --git a/src/intrp.def b/src/intrp.def index b43ac60..499ff71 100644 --- a/src/intrp.def +++ b/src/intrp.def @@ -940,9 +940,9 @@ DEFOP(INVOKESTATIC) LOG("Calling " + className + " " + method.name_ref.str + method.descriptor_ref.str) LOG("!! NATIVE !!") if (xl.jvm.internalJNITable[className] && methodId in xl.jvm.internalJNITable[className]){ - result = xl.jvm.internalJNITable[className][methodId].apply(cl,args); + result = {return_object: xl.jvm.internalJNITable[className][methodId].apply(cl,args)}; }else if (xl.jvm.JNITable[className] && methodId in xl.jvm.JNITable[className]){ - result = xl.jvm.JNITable[className][methodId].apply(cl,args) + result = {return_object: xl.jvm.JNITable[className][methodId].apply(cl,args)};s }else{ PANIC(methodId + " declared as native but not mapped"); } @@ -950,8 +950,8 @@ DEFOP(INVOKESTATIC) }else{ result = method.invoke(args,cl); } - if (result != undefined){ - OPPUSH(result); + if (result != undefined && result.return_object!= undefined){ + OPPUSH(result.return_object); } ENDDEF diff --git a/src/javaNativeInterface.js b/src/javaNativeInterface.js index ae759a7..3fd026b 100644 --- a/src/javaNativeInterface.js +++ b/src/javaNativeInterface.js @@ -51,7 +51,6 @@ function java_lang_Double_doubleToRawLongBits(d){ return new math.Long(y[0],y[1]); } -function bicavm_browser_Window_setLocation(s){ +function bicavm_browser_Window_setTitle(s){ window.document.title = javaString2JS(s); } -