X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fswingjs%2Fj2s%2Fswingjs%2Ftest%2FBugTest.js;fp=site%2Fswingjs%2Fj2s%2Fswingjs%2Ftest%2FBugTest.js;h=261b8a65763721e1cf54723ea784a3615eb12a77;hp=29528f3a50e81cd1d0ad5770c015007b5a0a14ec;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/swingjs/j2s/swingjs/test/BugTest.js b/site/swingjs/j2s/swingjs/test/BugTest.js index 29528f3..261b8a6 100644 --- a/site/swingjs/j2s/swingjs/test/BugTest.js +++ b/site/swingjs/j2s/swingjs/test/BugTest.js @@ -1,124 +1,124 @@ -Clazz.declarePackage ("swingjs.test"); -Clazz.load (["java.util.HashMap"], ["swingjs.test.BugTest", "$.A", "$.B"], null, function () { -c$ = Clazz.decorateAsClass (function () { -this.me = "me"; -this.name = null; -Clazz.instantialize (this, arguments); -}, swingjs.test, "BugTest", java.util.HashMap); -Clazz.makeConstructor (c$, -function () { -Clazz.superConstructor (this, swingjs.test.BugTest, []); -System.out.println ("this is BugTest()" + this.me); -}); -Clazz.makeConstructor (c$, -function (s) { -Clazz.superConstructor (this, swingjs.test.BugTest, []); -System.out.println ("this is BugTest(String):" + s + this.me); -}, "~S"); -Clazz.makeConstructor (c$, -function (o) { -Clazz.superConstructor (this, swingjs.test.BugTest, []); -System.out.println ("this is BugTest(Object[]):" + o + this.me); -}, "~A"); -Clazz.makeConstructor (c$, -function (s, t) { -Clazz.superConstructor (this, swingjs.test.BugTest, []); -System.out.println ("this is BugTest(String,String):" + s + t + this.me); -}, "~S,~S"); -Clazz.defineMethod (c$, "test", - function (a) { -System.out.println (a + " is an AbstractMap"); -}, "java.util.AbstractMap"); -Clazz.defineMethod (c$, "test", - function (ja) { -System.out.println (ja + " is an Object"); -}, "~O"); -Clazz.defineMethod (c$, "test1", - function (ja) { -System.out.println (ja + " is a Number"); -}, "Number"); -Clazz.defineMethod (c$, "test1", - function (ja) { -System.out.println (ja + " is an int"); -}, "~N"); -c$.getFont = Clazz.defineMethod (c$, "getFont", - function (f) { -return f; -}, "~S"); -c$.getFont = Clazz.defineMethod (c$, "getFont", - function (f, y) { -return f + y; -}, "~S,~S"); -c$.main = Clazz.defineMethod (c$, "main", -function (args) { - new swingjs.test.B ().init (); -try { -var cl; -cl = Clazz._4Name ("swingjs.test.BugTest"); -cl.getConstructor ([String, String]).newInstance ( Clazz.newArray (-1, ["test1", "test2"])); -cl.getConstructor ([Array]).newInstance ( Clazz.newArray (-1, [ Clazz.newArray (-1, ["test1", "test2"])])); -cl.getConstructor ([String, String]).newInstance (["test1", "test2"]); -cl.getConstructor ([]).newInstance ([]); -cl.newInstance (); -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -e.printStackTrace (); -} else { -throw e; -} -} -System.out.println (swingjs.test.BugTest.getFont ("f")); -System.out.println (swingjs.test.BugTest.getFont ("f", "y")); -var t = new swingjs.test.BugTest (); -t.name = "test"; -t.test1 (Integer.$valueOf (33)); -t.test1 (33); -t.test (t); -t.test (t); -var a2 = Clazz.newIntArray (2, 0); -var a20 = Clazz.newIntArray (2, 0); -var a23 = Clazz.newIntArray (2, 3, 0); -swingjs.test.BugTest.printit ([2, 3, 4, 5]); -System.out.println (args); -var test = Clazz.newCharArray (-1, ['1', '2', '3', '4', '5']); -var s = String.instantialize (test, 2, 3); -System.out.println ("char test: 345 = " + s); -}, "~A"); -c$.printit = Clazz.defineMethod (c$, "printit", -function (t) { -for (var i = 0; i < t.length; i++) System.out.println (t[i]); - -}, "~A"); -c$ = Clazz.declareType (swingjs.test, "A"); -Clazz.defineMethod (c$, "init", - function () { -System.out.println ("class A init"); -}); -Clazz.defineMethod (c$, "init", -function (a) { -System.out.println ("class A init String a"); -}, "~S"); -Clazz.defineMethod (c$, "init2", -function () { -System.out.println ("class A init2"); -this.init (); -}); -c$ = Clazz.declareType (swingjs.test, "B", swingjs.test.A); -Clazz.defineMethod (c$, "init", -function () { -var $private = Clazz.checkPrivateMethod (arguments); -if ($private != null) { -return $private.apply (this, arguments); -} -System.out.println ("class B init"); -Clazz.superCall (this, swingjs.test.B, "init2", []); -}); -Clazz.defineMethod (c$, "init", -function (b) { -var $private = Clazz.checkPrivateMethod (arguments); -if ($private != null) { -return $private.apply (this, arguments); -} -System.out.println ("class B init String b"); -}, "~S"); -}); +Clazz.declarePackage ("swingjs.test"); +Clazz.load (["java.util.HashMap"], ["swingjs.test.BugTest", "$.A", "$.B"], null, function () { +c$ = Clazz.decorateAsClass (function () { +this.me = "me"; +this.name = null; +Clazz.instantialize (this, arguments); +}, swingjs.test, "BugTest", java.util.HashMap); +Clazz.makeConstructor (c$, +function () { +Clazz.superConstructor (this, swingjs.test.BugTest, []); +System.out.println ("this is BugTest()" + this.me); +}); +Clazz.makeConstructor (c$, +function (s) { +Clazz.superConstructor (this, swingjs.test.BugTest, []); +System.out.println ("this is BugTest(String):" + s + this.me); +}, "~S"); +Clazz.makeConstructor (c$, +function (o) { +Clazz.superConstructor (this, swingjs.test.BugTest, []); +System.out.println ("this is BugTest(Object[]):" + o + this.me); +}, "~A"); +Clazz.makeConstructor (c$, +function (s, t) { +Clazz.superConstructor (this, swingjs.test.BugTest, []); +System.out.println ("this is BugTest(String,String):" + s + t + this.me); +}, "~S,~S"); +Clazz.defineMethod (c$, "test", + function (a) { +System.out.println (a + " is an AbstractMap"); +}, "java.util.AbstractMap"); +Clazz.defineMethod (c$, "test", + function (ja) { +System.out.println (ja + " is an Object"); +}, "~O"); +Clazz.defineMethod (c$, "test1", + function (ja) { +System.out.println (ja + " is a Number"); +}, "Number"); +Clazz.defineMethod (c$, "test1", + function (ja) { +System.out.println (ja + " is an int"); +}, "~N"); +c$.getFont = Clazz.defineMethod (c$, "getFont", + function (f) { +return f; +}, "~S"); +c$.getFont = Clazz.defineMethod (c$, "getFont", + function (f, y) { +return f + y; +}, "~S,~S"); +c$.main = Clazz.defineMethod (c$, "main", +function (args) { + new swingjs.test.B ().init (); +try { +var cl; +cl = Clazz._4Name ("swingjs.test.BugTest"); +cl.getConstructor ([String, String]).newInstance ( Clazz.newArray (-1, ["test1", "test2"])); +cl.getConstructor ([Array]).newInstance ( Clazz.newArray (-1, [ Clazz.newArray (-1, ["test1", "test2"])])); +cl.getConstructor ([String, String]).newInstance (["test1", "test2"]); +cl.getConstructor ([]).newInstance ([]); +cl.newInstance (); +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +e.printStackTrace (); +} else { +throw e; +} +} +System.out.println (swingjs.test.BugTest.getFont ("f")); +System.out.println (swingjs.test.BugTest.getFont ("f", "y")); +var t = new swingjs.test.BugTest (); +t.name = "test"; +t.test1 (Integer.$valueOf (33)); +t.test1 (33); +t.test (t); +t.test (t); +var a2 = Clazz.newIntArray (2, 0); +var a20 = Clazz.newIntArray (2, 0); +var a23 = Clazz.newIntArray (2, 3, 0); +swingjs.test.BugTest.printit ([2, 3, 4, 5]); +System.out.println (args); +var test = Clazz.newCharArray (-1, ['1', '2', '3', '4', '5']); +var s = String.instantialize (test, 2, 3); +System.out.println ("char test: 345 = " + s); +}, "~A"); +c$.printit = Clazz.defineMethod (c$, "printit", +function (t) { +for (var i = 0; i < t.length; i++) System.out.println (t[i]); + +}, "~A"); +c$ = Clazz.declareType (swingjs.test, "A"); +Clazz.defineMethod (c$, "init", + function () { +System.out.println ("class A init"); +}); +Clazz.defineMethod (c$, "init", +function (a) { +System.out.println ("class A init String a"); +}, "~S"); +Clazz.defineMethod (c$, "init2", +function () { +System.out.println ("class A init2"); +this.init (); +}); +c$ = Clazz.declareType (swingjs.test, "B", swingjs.test.A); +Clazz.defineMethod (c$, "init", +function () { +var $private = Clazz.checkPrivateMethod (arguments); +if ($private != null) { +return $private.apply (this, arguments); +} +System.out.println ("class B init"); +Clazz.superCall (this, swingjs.test.B, "init2", []); +}); +Clazz.defineMethod (c$, "init", +function (b) { +var $private = Clazz.checkPrivateMethod (arguments); +if ($private != null) { +return $private.apply (this, arguments); +} +System.out.println ("class B init String b"); +}, "~S"); +});