some even more evil tests

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@858 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 5d8f89b7d2
commit 1318566f84
  1. 109
      jode/test/AnonymousClass.java

@ -19,10 +19,16 @@
package jode.test; package jode.test;
import java.util.Vector;
public class AnonymousClass { public class AnonymousClass {
class Inner { class Inner {
int var = 3;
public void test() { public void test() {
class Hello { class Hello {
int var = 4;
Hello() { Hello() {
System.err.println("construct"); System.err.println("construct");
} }
@ -30,7 +36,7 @@ public class AnonymousClass {
System.err.println("construct: "+info); System.err.println("construct: "+info);
} }
void hello() { public void hello() {
this.hashCode(); this.hashCode();
Inner.this.hashCode(); Inner.this.hashCode();
AnonymousClass.this.hashCode(); AnonymousClass.this.hashCode();
@ -40,9 +46,15 @@ public class AnonymousClass {
final Hello hi = new Hello(); final Hello hi = new Hello();
final Hello ho = new Hello("ho"); final Hello ho = new Hello("ho");
final Object o = new Object() { final Object o = new Object() {
int blah = 5;
Hello hii = hi;
public String toString() { public String toString() {
this.hii.hello();
hi.hello(); hi.hello();
return Integer.toHexString(AnonymousClass.this.hashCode()); return Integer.toHexString(AnonymousClass.this.hashCode()
+blah);
} }
}; };
Object p = new Object() { Object p = new Object() {
@ -50,6 +62,99 @@ public class AnonymousClass {
return o.toString(); return o.toString();
} }
}; };
Hello blah = new Hello("Hello World") {
public void hello() {
System.err.println("overwritten");
}
};
Inner blub = new AnonymousClass().new Inner("Inner param") {
public void test() {
System.err.println("overwritten");
}
};
class Hi extends Inner {
public Hi() {
super("Hi World");
}
}
Vector v = new Vector(hi.var, new Inner("blah").var) {
public String toString() {
return super.toString();
}
};
Hi hu = new Hi();
}
Inner (String str) {
}
}
public void test() {
class Hello {
int var = 4;
Hello() {
System.err.println("construct");
}
Hello(String info) {
System.err.println("construct: "+info);
}
public void hello() {
this.hashCode();
AnonymousClass.this.hashCode();
System.err.println("HelloWorld");
}
};
final Hello hi = new Hello();
final Hello ho = new Hello("ho");
final Object o = new Object() {
int blah = 5;
Hello hii = hi;
public String toString() {
this.hii.hello();
hi.hello();
return Integer.toHexString(AnonymousClass.this.hashCode()
+blah);
}
};
Object p = new Object() {
public String toString() {
return o.toString();
}
};
Hello blah = new Hello("Hello World") {
public void hello() {
System.err.println("overwritten");
}
};
Inner blub = new Inner("Inner param") {
public void test() {
System.err.println("overwritten");
}
};
class Hi extends Inner {
public Hi() {
super("Hi World");
}
} }
Vector v = new Vector(hi.var, new Inner("blah").var) {
public String toString() {
return super.toString();
}
};
Hi hu = new Hi();
} }
} }

Loading…
Cancel
Save