33@ SuppressWarnings ("rawtypes" )
44class Test_Class extends Test_ {
55
6+ static class Test_Class_Inner {
7+ static Integer i = 5 ;
8+ static int i2 = new Integer (3 );
9+ static int ic = 'c' ;
10+ static char c = 'c' ;
11+ static Character c2 = 'c' ;
12+ static char c3 = new Character ('c' );
13+ }
14+
615 public Test_Class () {
716 System .out .println (true );
817 }
@@ -33,8 +42,30 @@ public static Test_Class newInstance(Object... objects) {
3342 return null ;
3443 }
3544
45+ String test = "testing" ;
46+ class B {
47+ String test = "testingB" ;
48+ void testB () {
49+ System .out .println (test );
50+ assert (test .equals ("testingB" ));
51+ System .out .println (Test_Class .this .test );
52+ assert (Test_Class .this .test .equals ("testing" ));
53+ test = "testc" ;
54+ assert (test .equals ("testc" ));
55+ test += "test" ;
56+ assert (test .equals ("testctest" ));
57+ test += Test_Class .this .test ;
58+ assert (test .equals ("testctesttesting" ));
59+ Test_Class .this .test += test ;
60+ assert (Test_Class .this .test .equals ("testingtestctesttesting" ));
61+
62+
63+ }
64+
65+ }
66+
3667 Class B () {
37- return null ;
68+ return B . class ;
3869 }
3970
4071 static class C extends Test_Class {
@@ -47,7 +78,22 @@ Class C() {
4778
4879 public static void main (String [] args ) {
4980
81+ class LocalClass {
82+
83+ String hello () {
84+ return "hello" ;
85+ }
86+ }
87+
88+
5089 try {
90+
91+ String s = new LocalClass ().hello ();
92+ System .out .println (s );
93+ assert (s .equals ("hello" ));
94+
95+
96+ new Test_Class ().new B ().testB ();
5197 Class <?> cl ;
5298 cl = Class .forName ("test.Test_Class" );
5399 cl .getConstructor (String .class , String .class ).newInstance (
@@ -58,7 +104,35 @@ public static void main(String[] args) {
58104 "test2" );
59105 Test_Class c = (Test_Class ) cl .getConstructor ().newInstance ();
60106 cl = c .C ();
61- cl .newInstance (); // fails in JavaScript - runs the static method instead
107+ cl .newInstance ();
108+
109+ String o = "" + java .util .concurrent .DelayQueue .class ;
110+ System .out .println (o );
111+ assert (("" + o ).equals ("class java.util.concurrent.DelayQueue" ));
112+ o = "" + java .awt .geom .Point2D .Double .class ;
113+ System .out .println (o );
114+ assert (("" + o ).equals ("class java.awt.geom.Point2D$Double" ));
115+
116+ o = "" + test .Test_Class .B .class ;
117+ System .out .println (o );
118+ assert (("" + o ).equals ("class test.Test_Class$B" ));
119+
120+ System .out .println (test .Test_Class .B .class .getSimpleName ());
121+ assert (test .Test_Class .B .class .getSimpleName ().equals ("B" ));
122+
123+ o = "" + test .Test_Class .C .class ;
124+ System .out .println (o );
125+ assert (("" + o ).equals ("class test.Test_Class$C" ));
126+
127+ System .out .println (test .Test_Class .C .class .getSimpleName ());
128+ assert (test .Test_Class .C .class .getSimpleName ().equals ("C" ));
129+
130+ System .out .println (LocalClass .class .isLocalClass ());
131+ assert (LocalClass .class .isLocalClass ());
132+
133+
134+ assert (("" + test .Test_Interface .class ).equals ("interface test.Test_Interface" ));
135+
62136 System .out .println ("Test_Class OK" );
63137 } catch (Exception e ) {
64138 // TODO Auto-generated catch block
0 commit comments