261b8a65763721e1cf54723ea784a3615eb12a77
[jalviewjs.git] / site / swingjs / j2s / swingjs / test / BugTest.js
1 Clazz.declarePackage ("swingjs.test");
2 Clazz.load (["java.util.HashMap"], ["swingjs.test.BugTest", "$.A", "$.B"], null, function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.me = "me";
5 this.name = null;
6 Clazz.instantialize (this, arguments);
7 }, swingjs.test, "BugTest", java.util.HashMap);
8 Clazz.makeConstructor (c$, 
9 function () {
10 Clazz.superConstructor (this, swingjs.test.BugTest, []);
11 System.out.println ("this is BugTest()" + this.me);
12 });
13 Clazz.makeConstructor (c$, 
14 function (s) {
15 Clazz.superConstructor (this, swingjs.test.BugTest, []);
16 System.out.println ("this is BugTest(String):" + s + this.me);
17 }, "~S");
18 Clazz.makeConstructor (c$, 
19 function (o) {
20 Clazz.superConstructor (this, swingjs.test.BugTest, []);
21 System.out.println ("this is BugTest(Object[]):" + o + this.me);
22 }, "~A");
23 Clazz.makeConstructor (c$, 
24 function (s, t) {
25 Clazz.superConstructor (this, swingjs.test.BugTest, []);
26 System.out.println ("this is BugTest(String,String):" + s + t + this.me);
27 }, "~S,~S");
28 Clazz.defineMethod (c$, "test", 
29  function (a) {
30 System.out.println (a + " is an AbstractMap");
31 }, "java.util.AbstractMap");
32 Clazz.defineMethod (c$, "test", 
33  function (ja) {
34 System.out.println (ja + " is an Object");
35 }, "~O");
36 Clazz.defineMethod (c$, "test1", 
37  function (ja) {
38 System.out.println (ja + " is a Number");
39 }, "Number");
40 Clazz.defineMethod (c$, "test1", 
41  function (ja) {
42 System.out.println (ja + " is an int");
43 }, "~N");
44 c$.getFont = Clazz.defineMethod (c$, "getFont", 
45  function (f) {
46 return f;
47 }, "~S");
48 c$.getFont = Clazz.defineMethod (c$, "getFont", 
49  function (f, y) {
50 return f + y;
51 }, "~S,~S");
52 c$.main = Clazz.defineMethod (c$, "main", 
53 function (args) {
54  new swingjs.test.B ().init ();
55 try {
56 var cl;
57 cl = Clazz._4Name ("swingjs.test.BugTest");
58 cl.getConstructor ([String, String]).newInstance ( Clazz.newArray (-1, ["test1", "test2"]));
59 cl.getConstructor ([Array]).newInstance ( Clazz.newArray (-1, [ Clazz.newArray (-1, ["test1", "test2"])]));
60 cl.getConstructor ([String, String]).newInstance (["test1", "test2"]);
61 cl.getConstructor ([]).newInstance ([]);
62 cl.newInstance ();
63 } catch (e) {
64 if (Clazz.exceptionOf (e, Exception)) {
65 e.printStackTrace ();
66 } else {
67 throw e;
68 }
69 }
70 System.out.println (swingjs.test.BugTest.getFont ("f"));
71 System.out.println (swingjs.test.BugTest.getFont ("f", "y"));
72 var t =  new swingjs.test.BugTest ();
73 t.name = "test";
74 t.test1 (Integer.$valueOf (33));
75 t.test1 (33);
76 t.test (t);
77 t.test (t);
78 var a2 =  Clazz.newIntArray (2, 0);
79 var a20 =  Clazz.newIntArray (2, 0);
80 var a23 =  Clazz.newIntArray (2, 3, 0);
81 swingjs.test.BugTest.printit ([2, 3, 4, 5]);
82 System.out.println (args);
83 var test =  Clazz.newCharArray (-1, ['1', '2', '3', '4', '5']);
84 var s =  String.instantialize (test, 2, 3);
85 System.out.println ("char test: 345 = " + s);
86 }, "~A");
87 c$.printit = Clazz.defineMethod (c$, "printit", 
88 function (t) {
89 for (var i = 0; i < t.length; i++) System.out.println (t[i]);
90
91 }, "~A");
92 c$ = Clazz.declareType (swingjs.test, "A");
93 Clazz.defineMethod (c$, "init", 
94  function () {
95 System.out.println ("class A init");
96 });
97 Clazz.defineMethod (c$, "init", 
98 function (a) {
99 System.out.println ("class A init String a");
100 }, "~S");
101 Clazz.defineMethod (c$, "init2", 
102 function () {
103 System.out.println ("class A init2");
104 this.init ();
105 });
106 c$ = Clazz.declareType (swingjs.test, "B", swingjs.test.A);
107 Clazz.defineMethod (c$, "init", 
108 function () {
109 var $private = Clazz.checkPrivateMethod (arguments);
110 if ($private != null) {
111 return $private.apply (this, arguments);
112 }
113 System.out.println ("class B init");
114 Clazz.superCall (this, swingjs.test.B, "init2", []);
115 });
116 Clazz.defineMethod (c$, "init", 
117 function (b) {
118 var $private = Clazz.checkPrivateMethod (arguments);
119 if ($private != null) {
120 return $private.apply (this, arguments);
121 }
122 System.out.println ("class B init String b");
123 }, "~S");
124 });