aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorNingZhang-Ericsson <ning.n.zhang@ericsson.com>2018-07-13 13:06:20 +0800
committerNingZhang-Ericsson <ning.n.zhang@ericsson.com>2018-07-13 13:06:20 +0800
commitfd1d535bb36e3d6cc2a82d19784c45f29c064cc7 (patch)
tree8dedb97445e157fa8c478d0f8ebda00dcc8cba6e /src/test
parenta59658da9986ec2a9952a6539000c57ff1f02026 (diff)
downloadjavassist-fd1d535bb36e3d6cc2a82d19784c45f29c064cc7.tar.gz
javassist-fd1d535bb36e3d6cc2a82d19784c45f29c064cc7.zip
fixed JASSIST-267
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test/javassist/proxy/ProxySimpleTest.java49
1 files changed, 47 insertions, 2 deletions
diff --git a/src/test/test/javassist/proxy/ProxySimpleTest.java b/src/test/test/javassist/proxy/ProxySimpleTest.java
index 212c15fa..76178a7e 100644
--- a/src/test/test/javassist/proxy/ProxySimpleTest.java
+++ b/src/test/test/javassist/proxy/ProxySimpleTest.java
@@ -1,7 +1,5 @@
package test.javassist.proxy;
-import junit.framework.TestCase;
-
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
@@ -13,6 +11,7 @@ import javassist.util.proxy.MethodFilter;
import javassist.util.proxy.MethodHandler;
import javassist.util.proxy.Proxy;
import javassist.util.proxy.ProxyFactory;
+import junit.framework.TestCase;
@SuppressWarnings({"rawtypes","unchecked"})
public class ProxySimpleTest extends TestCase {
@@ -286,4 +285,50 @@ public class ProxySimpleTest extends TestCase {
protected void bar(int i) { result += "q"; }
public void baz(int i) { result += "r"; }
}
+
+
+ String value267;
+
+ public void testJIRA267() throws Exception {
+ Extended267 extended267 = new Extended267();
+ for (Method method: extended267.getClass().getMethods()) {
+ System.out.println(method.getName() + "::" + method.getModifiers() + ":" + method.getParameterCount() + ":" + method.isSynthetic() + ":" + method.isBridge());
+ }
+ ProxyFactory factory = new ProxyFactory();
+ factory.setSuperclass(Extended267.class);
+ Extended267 e = (Extended267)factory.create(null, null, new MethodHandler() {
+ @Override
+ public Object invoke(Object self, Method thisMethod,
+ Method proceed, Object[] args) throws Throwable {
+ value267 += thisMethod.getDeclaringClass().getName();
+ return proceed.invoke(self, args);
+ }
+ });
+
+ value267 = "";
+ assertEquals("base", e.base());
+ System.out.println(value267);
+ assertEquals(Extended267.class.getName(), value267);
+
+ value267 = "";
+ assertEquals("base2", e.base("2"));
+ System.out.println(value267);
+ assertEquals(Extended267.class.getName(), value267);
+
+ value267 = "";
+ assertEquals("extended22", e.base(2));
+ System.out.println(value267);
+ assertEquals(Extended267.class.getName(), value267);
+ }
+
+ private static abstract class Base267 {
+ public String base() { return "base"; }
+ public String base(String s) { return "base" + s; }
+ public String base(Integer i) { return "base" + i; }
+ }
+
+ public static class Extended267 extends Base267 {
+ public String base(Integer i) { return "extended" + i + i; }
+ }
+
}