aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/testproxy
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/testproxy')
-rw-r--r--src/test/testproxy/BridgeMethod.java19
-rw-r--r--src/test/testproxy/ProxyFactoryPerformanceTest.java195
-rw-r--r--src/test/testproxy/ProxyTester.java403
-rw-r--r--src/test/testproxy/Target.java17
-rw-r--r--src/test/testproxy/Target1.java5
-rw-r--r--src/test/testproxy/Target2.java17
-rw-r--r--src/test/testproxy/Target3.java6
-rw-r--r--src/test/testproxy/Target4.java9
-rw-r--r--src/test/testproxy/Target5.java7
-rw-r--r--src/test/testproxy/TargetInit.java10
-rw-r--r--src/test/testproxy/sub/TargetSuper.java7
11 files changed, 695 insertions, 0 deletions
diff --git a/src/test/testproxy/BridgeMethod.java b/src/test/testproxy/BridgeMethod.java
new file mode 100644
index 00000000..de199bf0
--- /dev/null
+++ b/src/test/testproxy/BridgeMethod.java
@@ -0,0 +1,19 @@
+package testproxy;
+
+interface BridgeMethodInf {
+ public Long getId();
+ public void setId(Long id);
+ public Number m1();
+}
+
+abstract class BridgeMethodSuper<T> {
+ public abstract T id(T t);
+}
+
+public class BridgeMethod extends BridgeMethodSuper<String> implements BridgeMethodInf {
+ private Long id;
+ public Long getId() { return id; }
+ public void setId(Long id) { this.id = id; }
+ public Integer m1() { return 7; }
+ public String id(String s) { return s; }
+}
diff --git a/src/test/testproxy/ProxyFactoryPerformanceTest.java b/src/test/testproxy/ProxyFactoryPerformanceTest.java
new file mode 100644
index 00000000..5ce0adb6
--- /dev/null
+++ b/src/test/testproxy/ProxyFactoryPerformanceTest.java
@@ -0,0 +1,195 @@
+package testproxy;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+/**
+import net.sf.cglib.proxy.CallbackFilter;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.InvocationHandler;
+import net.sf.cglib.proxy.NoOp;
+*/
+import javassist.util.proxy.MethodFilter;
+import javassist.util.proxy.MethodHandler;
+import javassist.util.proxy.ProxyFactory;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+public class ProxyFactoryPerformanceTest extends TestCase {
+
+ public static final int COUNT = 100;
+
+ public static final int MAX_THREADS = 30;
+
+ static Throwable error = null;
+
+ public ProxyFactoryPerformanceTest() {}
+
+ public ProxyFactoryPerformanceTest(String name) {
+ super(name);
+ }
+
+ public void testJavassist() throws Throwable {
+ callCreateClass("javassist", ProxyMaker.class);
+ }
+
+ /**
+ public void testCglib() throws Exception {
+ callCreateClass("cglib", EnhancerUser.class);
+ }
+ */
+
+ public void callCreateClass(String translator, Class cl) throws Throwable {
+ error = null;
+ Thread[] threads = new Thread[MAX_THREADS];
+ for (int i = 0; i < threads.length; ++i) {
+ threads[i] = (Thread)cl.newInstance();
+ }
+ long time = System.currentTimeMillis();
+ for (int i = 0; i < threads.length; ++i) {
+ threads[i].start();
+ }
+ for (int i = 0; i < threads.length; ++i) {
+ threads[i].join();
+ }
+ time = System.currentTimeMillis() - time;
+ System.out.println("ProxyFactoryPerformanceTest: " + translator + " time: " + time);
+ if (error != null)
+ throw error;
+ }
+
+ public static Test suite() {
+ return new TestSuite(ProxyFactoryPerformanceTest.class);
+ }
+
+ public static void callOnce() {
+ try {
+ Thread t = new ProxyMaker();
+ t.start();
+ t.join();
+ }
+ catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ System.out.println("** Done");
+ }
+
+ public static void main(String[] args) {
+ // callOnce();
+ ProxyFactory.useCache = args.length == 0;
+ TestRunner.run(suite());
+ }
+}
+
+class ProxyMaker extends Thread implements MethodHandler {
+ private static final MethodFilter FINALIZE_FILTER = new MethodFilter() {
+ public boolean isHandled(Method m) {
+ // skip finalize methods
+ return !( m.getParameterTypes().length == 0 && m.getName().equals( "finalize" ) );
+ }
+ };
+
+ public void run() {
+ for (int i = 0; i < ProxyFactoryPerformanceTest.COUNT; ++i) {
+ callCreateClass();
+ }
+ }
+
+ public void callCreateClass() {
+ try {
+ ProxyFactory factory = new ProxyFactory();
+ factory.setSuperclass(SampleBean.class);
+ factory.setInterfaces(SampleBean.class.getInterfaces());
+ factory.setFilter(FINALIZE_FILTER);
+ factory.setHandler(this);
+
+ Class proxyClass = factory.createClass();
+ //System.out.println("proxy name: " + proxyClass.getName());
+ } catch (Throwable e) {
+ e.printStackTrace();
+ ProxyFactoryPerformanceTest.error = e;
+ }
+ }
+
+ public Object invoke(Object arg0, Method arg1, Method arg2, Object[] arg3) throws Throwable {
+ return null;
+ }
+}
+
+/**
+class EnhancerUser extends Thread implements InvocationHandler {
+ private static final CallbackFilter FINALIZE_FILTER = new CallbackFilter() {
+ public int accept(Method method) {
+ if ( method.getParameterTypes().length == 0 && method.getName().equals("finalize") ){
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+ };
+
+ public void run() {
+ for (int i = 0; i < ProxyFactoryPerformanceTest.COUNT; ++i) {
+ callCreateClass();
+ }
+ }
+
+ public void callCreateClass() {
+ try {
+ Enhancer enhancer = new Enhancer();
+ enhancer.setSuperclass(SampleBean.class);
+ enhancer.setInterfaces(SampleBean.class.getInterfaces());
+ enhancer.setCallbackTypes(new Class[] { InvocationHandler.class, NoOp.class });
+ enhancer.setCallbackFilter(FINALIZE_FILTER);
+ enhancer.setInterceptDuringConstruction(false);
+ // TODO
+ enhancer.setUseCache(false);
+ enhancer.setUseFactory(false);
+ Class proxyClass = enhancer.createClass();
+ //System.out.println("proxy name: " + proxyClass.getName());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public Object invoke(Object arg0, Method arg1, Object[] arg2) throws Throwable {
+ return null;
+ }
+}
+*/
+
+class SampleBean implements Serializable {
+ long oid;
+
+ int version;
+
+ SampleBean bean;
+
+ public void setOid(long _oid) {
+ oid = _oid;
+ }
+
+ public long getOid() {
+ return oid;
+ }
+
+ public void setVersion(int _ver) {
+ version = _ver;
+ }
+
+ public int getVersion() {
+ return version;
+ }
+
+ public void setBean(SampleBean _bean) {
+ bean = _bean;
+ }
+
+ public SampleBean getBean() {
+ return bean;
+ }
+}
diff --git a/src/test/testproxy/ProxyTester.java b/src/test/testproxy/ProxyTester.java
new file mode 100644
index 00000000..fe956f5e
--- /dev/null
+++ b/src/test/testproxy/ProxyTester.java
@@ -0,0 +1,403 @@
+package testproxy;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.InvocationTargetException;
+import javassist.util.proxy.ProxyFactory;
+import javassist.util.proxy.MethodFilter;
+import javassist.util.proxy.MethodHandler;
+import javassist.util.proxy.ProxyObject;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import java.io.*;
+
+public class ProxyTester extends TestCase {
+ public ProxyTester(String s) {
+ super(s);
+ }
+
+ public ProxyTester() {
+ this("proxy");
+ }
+
+ static class Interceptor1 implements MethodHandler {
+ int counter = 0;
+
+ public Object invoke(Object self, Method m, Method proceed,
+ Object[] args) throws Exception {
+ System.out.println("intercept: " + m + ", proceed: " + proceed
+ + ", modifier: "
+ + Modifier.toString(proceed.getModifiers()));
+ counter++;
+ return proceed.invoke(self, args);
+ }
+ }
+
+ static class Interceptor2 implements MethodHandler {
+ int counter = 0;
+ public Object invoke(Object self, Method m, Method proceed,
+ Object[] args) throws Exception {
+ System.out.println("intercept: " + m + ", proceed: " + proceed);
+ counter++;
+ if (proceed != null)
+ return proceed.invoke(self, args);
+ else
+ if (m.getReturnType() == int.class)
+ return new Integer(3);
+ else
+ return "OK";
+ }
+ }
+
+ static MethodFilter finalizeRemover = new MethodFilter() {
+ public boolean isHandled(Method m) {
+ return !m.getName().equals("finalize");
+ }
+ };
+
+ public void testTarget() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ f.setSuperclass(Target.class);
+ Interceptor1 interceptor = new Interceptor1();
+ f.setHandler(interceptor);
+ f.setFilter(finalizeRemover);
+ f.writeDirectory = ".";
+ Class c = f.createClass();
+ Target obj = (Target)c.newInstance();
+ obj.m();
+ assertEquals(true, obj.m(true));
+ assertEquals((byte)1, obj.m1((byte)1));
+ assertEquals('a', obj.m2('a'));
+ assertEquals((short)2, obj.m3((short)2));
+ assertEquals(3, obj.m(3));
+ assertEquals(4L, obj.m5(4L));
+ assertTrue(5.0F == obj.m6(5.0F));
+ assertTrue(6.0 == obj.m7(6.0));
+ assertEquals("test", obj.m("test"));
+ int[] ia = { 1, 2, 3 };
+ assertEquals(ia, obj.m7(ia));
+ String[] sa = { "1", "2" };
+ assertEquals(sa, obj.m8(sa));
+ assertEquals(obj, obj.m9(3, obj, null));
+ assertEquals(14, interceptor.counter);
+ }
+
+ public void testTarget1() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ f.setSuperclass(Target1.class);
+ Interceptor1 interceptor = new Interceptor1();
+ f.setHandler(interceptor);
+ f.setFilter(finalizeRemover);
+ Class c = f.createClass();
+ Target1 obj = (Target1)c.newInstance();
+ assertEquals(null, obj.m(null));
+ assertEquals(1, interceptor.counter);
+ }
+
+ public void testObject() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ Interceptor1 interceptor = new Interceptor1();
+ f.setHandler(interceptor);
+ f.setFilter(finalizeRemover);
+ Class c = f.createClass();
+ Object obj = (Object)c.newInstance();
+ System.out.println(obj.toString());
+ assertEquals(2, interceptor.counter);
+ }
+
+ public void testSetter() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ f.writeDirectory = ".";
+ Interceptor1 interceptor = new Interceptor1();
+ f.setHandler(interceptor);
+ f.setFilter(finalizeRemover);
+ Class c = f.createClass();
+ Object obj = (Object)c.newInstance();
+ System.out.println("setter1: " + obj.toString());
+ ((ProxyObject)obj).setHandler(new MethodHandler() {
+ public Object invoke(Object self, Method m, Method proceed,
+ Object[] args) throws Exception {
+ System.out.print("intercept: " + m);
+ return "OK";
+ }
+ });
+ assertEquals("OK", obj.toString());
+ }
+
+ public void testString() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ Interceptor1 interceptor = new Interceptor1();
+ f.setHandler(interceptor);
+ f.setFilter(finalizeRemover);
+ f.setSuperclass(String.class);
+ try {
+ Class c = f.createClass();
+ Assert.fail("String is final!");
+ }
+ catch (RuntimeException e) {
+ System.out.println(e);
+ }
+ }
+
+ public void testConstructor() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ Interceptor1 interceptor = new Interceptor1();
+ f.setHandler(interceptor);
+ f.setFilter(finalizeRemover);
+ f.setSuperclass(Target2.class);
+ Class c = f.createClass();
+ Constructor[] cons = c.getDeclaredConstructors();
+ assertEquals(3, cons.length);
+ Constructor con1 = c.getDeclaredConstructor(new Class[] { int.class });
+ Constructor con2 = c.getDeclaredConstructor(new Class[] { int.class, int.class });
+ Method m1 = c.getDeclaredMethod("get", new Class[0]);
+ Method m2 = c.getDeclaredMethod("foo", new Class[0]);
+ assertEquals(0, m1.getExceptionTypes().length);
+ assertEquals("java.io.IOException", m2.getExceptionTypes()[0].getName());
+
+ Target2 t2 = (Target2)con1.newInstance(new Object[] { new Integer(1) });
+ System.out.println(t2.toString());
+ assertEquals(2, interceptor.counter);
+
+ interceptor.counter = 0;
+ assertEquals(2, t2.foo());
+ assertEquals(4, t2._dfoo());
+ assertEquals(2, interceptor.counter);
+ }
+
+ public void testInterface() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ Interceptor2 interceptor2 = new Interceptor2();
+ f.setHandler(interceptor2);
+ f.setFilter(finalizeRemover);
+ f.setInterfaces(new Class[] { Target3.class });
+ Class c = f.createClass();
+ Target3 obj = (Target3)c.newInstance();
+ assertEquals("OK", obj.m());
+ System.out.println(obj.toString());
+ assertEquals(3, interceptor2.counter);
+ }
+
+ public void test2Interfaces() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ Interceptor2 interceptor2 = new Interceptor2();
+ f.setHandler(interceptor2);
+ f.setFilter(finalizeRemover);
+ f.setInterfaces(new Class[] { Target3.class, Target4.class });
+ Class c = f.createClass();
+ Target3 obj = (Target3)c.newInstance();
+ assertEquals("OK", obj.m());
+ System.out.println(obj.toString());
+ assertEquals(3, interceptor2.counter);
+
+ interceptor2.counter = 0;
+ Target4 obj4 = (Target4)c.newInstance();
+ assertEquals(3, obj4.bar4());
+ assertEquals(3, obj4.foo4());
+ assertEquals(2, interceptor2.counter);
+ }
+
+ public void testFilter() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ Interceptor2 interceptor2 = new Interceptor2();
+ f.setHandler(interceptor2);
+ f.setFilter(finalizeRemover);
+ f.setInterfaces(new Class[] { Target3.class });
+ f.setFilter(new MethodFilter() {
+ public boolean isHandled(Method m) {
+ return m.getDeclaringClass() != Object.class;
+ }
+ });
+ Class c = f.createClass();
+ Target3 obj = (Target3)c.newInstance();
+ assertEquals("OK", obj.m());
+ System.out.println(obj.toString());
+ assertEquals(1, interceptor2.counter);
+ }
+
+ public static boolean testInitFlag;
+
+ public void testInit() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ f.setSuperclass(TargetInit.class);
+ MethodHandler handler = new MethodHandler() {
+ public Object invoke(Object self, Method m,
+ Method proceed, Object[] args) throws Exception {
+ System.out.println("testInit " + testInitFlag);
+ return proceed.invoke(self, args);
+ }
+ };
+ testInitFlag = false;
+ Class c = f.createClass();
+ assertTrue(testInitFlag); // since 3.12. Before then, this line was assertFalse(testInitFlag);
+ System.out.println("testInit createClass(): " + testInitFlag);
+ TargetInit obj = (TargetInit)c.newInstance();
+ assertTrue(testInitFlag);
+ System.out.println("testInit newInstance(): " + testInitFlag);
+ ((ProxyObject)obj).setHandler(handler);
+ assertEquals("OK", obj.m());
+ }
+
+ public void testCreate() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ f.setSuperclass(Target5.class);
+ Interceptor1 interceptor = new Interceptor1();
+ f.setHandler(interceptor);
+ f.setFilter(finalizeRemover);
+ Class c = f.createClass();
+ Target5 obj = (Target5)f.create(new Class[] { int.class }, new Object[] { new Integer(3) });
+ assertEquals(3, obj.get());
+ }
+
+
+ public void testBridgeMethod() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ f.writeDirectory = ".";
+ f.setSuperclass(BridgeMethod.class);
+ Interceptor1 interceptor = new Interceptor1();
+ f.setHandler(interceptor);
+ f.setFilter(finalizeRemover);
+ Class c = f.createClass();
+ BridgeMethod obj = (BridgeMethod)c.newInstance();
+ Integer value = obj.m1();
+ assertEquals(7, value.intValue());
+ BridgeMethodInf inf = (BridgeMethodInf)obj;
+ Number num = inf.m1();
+ assertEquals(7, num.intValue());
+ BridgeMethodSuper sup = obj;
+ try {
+ Object x = sup.id(new Object());
+ fail("not cast error");
+ }
+ catch (ClassCastException e) {}
+ catch (Exception e) {
+ if (e instanceof InvocationTargetException)
+ if (e.getCause() instanceof ClassCastException)
+ return;
+
+ throw e;
+ }
+ }
+
+ public void testGetters() throws Exception {
+ ProxyFactory f = new ProxyFactory();
+ Class c = ProxyTester.class;
+ f.setSuperclass(c);
+ assertEquals(c, f.getSuperclass());
+ Class i = java.io.Serializable.class;
+ f.setInterfaces(new Class[] { i });
+ assertEquals(i, f.getInterfaces()[0]);
+ }
+
+ static class ProxyFactory2 extends ProxyFactory {
+ public ClassLoader getClassLoader2() {
+ return getClassLoader();
+ }
+ }
+
+ public void testProvider() throws Exception {
+ ProxyFactory.ClassLoaderProvider cp = ProxyFactory.classLoaderProvider;
+ final ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ ProxyFactory.classLoaderProvider = new ProxyFactory.ClassLoaderProvider() {
+ public ClassLoader get(ProxyFactory pf) {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ };
+
+ ProxyFactory2 pf = new ProxyFactory2();
+ assertEquals(cl, pf.getClassLoader2());
+ ProxyFactory.classLoaderProvider = cp;
+ }
+
+ public void testCache() throws Exception {
+ boolean prev = ProxyFactory.useCache;
+ ProxyFactory.useCache = true;
+ ProxyFactory f = new ProxyFactory();
+ f.setSuperclass(Cache1.class);
+ Class c = f.createClass();
+ ProxyFactory f2 = new ProxyFactory();
+ f2.setSuperclass(Cache1.class);
+ assertEquals(c, f2.createClass());
+ ProxyFactory f3 = new ProxyFactory();
+ f3.setSuperclass(Cache1.class);
+ f3.setHandler(new Interceptor1());
+ assertFalse(c == f3.createClass());
+ ProxyFactory f4 = new ProxyFactory();
+ f4.setSuperclass(Cache1.class);
+ f4.setInterfaces(new Class[] { Cache2.class });
+ Class c4 = f4.createClass();
+ assertFalse(c == c4);
+ ProxyFactory f5 = new ProxyFactory();
+ f5.setSuperclass(Cache1.class);
+ f5.setInterfaces(new Class[] { Cache2.class });
+ assertEquals(c4, f5.createClass());
+ ProxyFactory f6 = new ProxyFactory();
+ f6.setInterfaces(new Class[] { Cache2.class });
+ assertFalse(c4 == f6.createClass());
+ ProxyFactory.useCache = prev;
+ }
+
+ public static class Cache1 {
+ public int foo() { return 0; }
+ }
+
+ public static interface Cache2 {
+ public int bar();
+ }
+
+ public void testReadWrite() throws Exception {
+ final String fileName = "read-write.bin";
+ ProxyFactory.ClassLoaderProvider cp = ProxyFactory.classLoaderProvider;
+ ProxyFactory.classLoaderProvider = new ProxyFactory.ClassLoaderProvider() {
+ public ClassLoader get(ProxyFactory pf) {
+ return new javassist.Loader();
+ }
+ };
+ ProxyFactory pf = new ProxyFactory();
+ pf.setSuperclass(ReadWriteData.class);
+ Object data = pf.createClass().newInstance();
+ // Object data = new ReadWriteData();
+ ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(fileName));
+ oos.writeObject(data);
+ oos.close();
+ ProxyFactory.classLoaderProvider = cp;
+
+ ObjectInputStream ois = new ObjectInputStream(new FileInputStream(fileName));
+ Object data2 = ois.readObject();
+ ois.close();
+ int i = ((ReadWriteData)data2).foo();
+ assertEquals(4, i);
+ }
+
+ public static class ReadWriteData implements Serializable {
+ public int foo() { return 4; }
+ }
+
+ public void testWriteReplace() throws Exception {
+ ProxyFactory pf = new ProxyFactory();
+ pf.setSuperclass(WriteReplace.class);
+ Object data = pf.createClass().newInstance();
+ assertEquals(data, ((WriteReplace)data).writeReplace());
+
+ ProxyFactory pf2 = new ProxyFactory();
+ pf2.setSuperclass(WriteReplace2.class);
+ Object data2 = pf2.createClass().newInstance();
+ Method meth = data2.getClass().getDeclaredMethod("writeReplace", new Class[0]);
+ assertEquals("javassist.util.proxy.SerializedProxy",
+ meth.invoke(data2, new Object[0]).getClass().getName());
+ }
+
+ public static class WriteReplace implements Serializable {
+ public Object writeReplace() { return this; }
+ }
+
+ public static class WriteReplace2 implements Serializable {
+ public Object writeReplace(int i) { return new Integer(i); }
+ }
+
+ public static void main(String[] args) {
+ // javassist.bytecode.ClassFile.MAJOR_VERSION = javassist.bytecode.ClassFile.JAVA_6;
+ junit.textui.TestRunner.run(ProxyTester.class);
+ }
+}
diff --git a/src/test/testproxy/Target.java b/src/test/testproxy/Target.java
new file mode 100644
index 00000000..ab6789f2
--- /dev/null
+++ b/src/test/testproxy/Target.java
@@ -0,0 +1,17 @@
+package testproxy;
+
+public class Target {
+ public void m() {}
+ public boolean m(boolean b) { return b; }
+ public byte m1(byte b) { return b; }
+ public char m2(char c) { return c; }
+ public short m3(short s) { return s; }
+ public int m(int i) { return i; }
+ public long m5(long j) { return j; }
+ public float m6(float f) { return f; }
+ public double m7(double d) { return d; }
+ public String m(String s) { return s; }
+ public int[] m7(int[] i) { return i; }
+ public String[] m8(String[] s) { return s; }
+ public Target m9(int i, Target t, Target[][] t2) { return t; }
+}
diff --git a/src/test/testproxy/Target1.java b/src/test/testproxy/Target1.java
new file mode 100644
index 00000000..ce972d04
--- /dev/null
+++ b/src/test/testproxy/Target1.java
@@ -0,0 +1,5 @@
+package testproxy;
+
+public class Target1 {
+ public Target1[][] m(Target1[][] a) { return a; }
+}
diff --git a/src/test/testproxy/Target2.java b/src/test/testproxy/Target2.java
new file mode 100644
index 00000000..91b57be5
--- /dev/null
+++ b/src/test/testproxy/Target2.java
@@ -0,0 +1,17 @@
+package testproxy;
+
+import java.io.IOException;
+
+public class Target2 {
+ private int value;
+ public Target2(int i) { value = 1; }
+ protected Target2(int i, int j) { value = 2; }
+ private Target2(int i, double j) { value = 3; }
+ Target2(int i, long k) { value = 4; }
+
+ public int get() { return value; }
+ public int foo() throws IOException { return ++value; }
+ public int _dfoo() { value += 2; return value; }
+ private int _d100() { value += 3; return value; }
+ private int _d1003foo() { value += 3; return value; }
+}
diff --git a/src/test/testproxy/Target3.java b/src/test/testproxy/Target3.java
new file mode 100644
index 00000000..c9c8f66c
--- /dev/null
+++ b/src/test/testproxy/Target3.java
@@ -0,0 +1,6 @@
+package testproxy;
+
+public interface Target3 {
+ String m();
+ String toString();
+}
diff --git a/src/test/testproxy/Target4.java b/src/test/testproxy/Target4.java
new file mode 100644
index 00000000..82ddef69
--- /dev/null
+++ b/src/test/testproxy/Target4.java
@@ -0,0 +1,9 @@
+package testproxy;
+
+interface Target4Super {
+ int foo4();
+}
+
+public interface Target4 extends Target4Super {
+ int bar4();
+}
diff --git a/src/test/testproxy/Target5.java b/src/test/testproxy/Target5.java
new file mode 100644
index 00000000..f40183a8
--- /dev/null
+++ b/src/test/testproxy/Target5.java
@@ -0,0 +1,7 @@
+package testproxy;
+
+public class Target5 {
+ private int value;
+ public Target5(int i) { value = i; }
+ public int get() { return value; }
+}
diff --git a/src/test/testproxy/TargetInit.java b/src/test/testproxy/TargetInit.java
new file mode 100644
index 00000000..0654593a
--- /dev/null
+++ b/src/test/testproxy/TargetInit.java
@@ -0,0 +1,10 @@
+package testproxy;
+
+public class TargetInit {
+ static {
+ System.out.println("TargetInit <clinit>");
+ ProxyTester.testInitFlag = true;
+ }
+
+ public String m() { return "OK"; }
+}
diff --git a/src/test/testproxy/sub/TargetSuper.java b/src/test/testproxy/sub/TargetSuper.java
new file mode 100644
index 00000000..0e40cded
--- /dev/null
+++ b/src/test/testproxy/sub/TargetSuper.java
@@ -0,0 +1,7 @@
+package testproxy.sub;
+
+public class TargetSuper {
+ private int poi() { return 1; }
+ int poi2() { return 2; }
+ public int poi3() { return 3; }
+}