From 1318566f84f3b1d033c892e6852e2bd5a9c5e089 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 17 Jun 1999 11:07:52 +0000 Subject: [PATCH] some even more evil tests git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@858 379699f6-c40d-0410-875b-85095c16579e --- jode/test/AnonymousClass.java | 109 +++++++++++++++++++++++++++++++++- 1 file changed, 107 insertions(+), 2 deletions(-) diff --git a/jode/test/AnonymousClass.java b/jode/test/AnonymousClass.java index e974db9..fe06260 100644 --- a/jode/test/AnonymousClass.java +++ b/jode/test/AnonymousClass.java @@ -19,10 +19,16 @@ package jode.test; +import java.util.Vector; + public class AnonymousClass { class Inner { + int var = 3; + public void test() { class Hello { + int var = 4; + Hello() { System.err.println("construct"); } @@ -30,7 +36,7 @@ public class AnonymousClass { System.err.println("construct: "+info); } - void hello() { + public void hello() { this.hashCode(); Inner.this.hashCode(); AnonymousClass.this.hashCode(); @@ -40,9 +46,15 @@ public class AnonymousClass { 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()); + return Integer.toHexString(AnonymousClass.this.hashCode() + +blah); } }; Object p = new Object() { @@ -50,6 +62,99 @@ public class AnonymousClass { 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(); + } }