aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorchibash <chiba@javassist.org>2015-08-07 00:48:03 +0900
committerchibash <chiba@javassist.org>2015-08-07 00:48:03 +0900
commitf7543857669ad5fff98d61a75a4f04d848ef4820 (patch)
tree55d6a962f0fc7045e1a1054567981641a11878ed /src/test
parentaf8aba0dd41ff5c72b63ba3770a829bffecdb7b4 (diff)
downloadjavassist-f7543857669ad5fff98d61a75a4f04d848ef4820.tar.gz
javassist-f7543857669ad5fff98d61a75a4f04d848ef4820.zip
fixed JASSIST-244
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test/javassist/proxy/ProxySimpleTest.java41
-rw-r--r--src/test/testproxy/ProxyTester.java4
2 files changed, 43 insertions, 2 deletions
diff --git a/src/test/test/javassist/proxy/ProxySimpleTest.java b/src/test/test/javassist/proxy/ProxySimpleTest.java
index cab62397..f37e7b8c 100644
--- a/src/test/test/javassist/proxy/ProxySimpleTest.java
+++ b/src/test/test/javassist/proxy/ProxySimpleTest.java
@@ -99,4 +99,45 @@ public class ProxySimpleTest extends TestCase {
public static class WriteReplace2 implements Serializable {
public Object writeReplace(int i) { return new Integer(i); }
}
+
+ String value244;
+
+ public void testJIRA244() throws Exception {
+ ProxyFactory factory = new ProxyFactory();
+ factory.setSuperclass(Extended244.class);
+ Extended244 e = (Extended244)factory.create(null, null, new MethodHandler() {
+ @Override
+ public Object invoke(Object self, Method thisMethod,
+ Method proceed, Object[] args) throws Throwable {
+ value244 += thisMethod.getDeclaringClass().getName();
+ return proceed.invoke(self);
+ }
+ });
+
+ value244 = "";
+ assertEquals("base", e.base());
+ System.out.println(value244);
+ assertEquals(Extended244.class.getName(), value244);
+
+ value244 = "";
+ assertEquals("ext", e.extended());
+ System.out.println(value244);
+ assertEquals(Extended244.class.getName(), value244);
+
+ value244 = "";
+ assertEquals("base2ext2", e.base2());
+ System.out.println(value244);
+ assertEquals(Extended244.class.getName(), value244);
+ }
+
+ // if Base244 is private, then Extended244 has a bridge method for base().
+ private static abstract class Base244 {
+ public String base() { return "base"; }
+ public String base2() { return "base2"; }
+ }
+
+ public static class Extended244 extends Base244 {
+ public String extended() { return "ext"; }
+ public String base2() { return super.base2() + "ext2"; }
+ }
}
diff --git a/src/test/testproxy/ProxyTester.java b/src/test/testproxy/ProxyTester.java
index 6d5559b6..e06848f8 100644
--- a/src/test/testproxy/ProxyTester.java
+++ b/src/test/testproxy/ProxyTester.java
@@ -399,7 +399,7 @@ public class ProxyTester extends TestCase {
public static void testJIRA189() throws Exception {
Class persistentClass = Target189.PublishedArticle.class;
ProxyFactory factory = new ProxyFactory();
- factory.writeDirectory = ".";
+ // factory.writeDirectory = ".";
factory.setUseCache(false);
factory.setSuperclass(persistentClass);
factory.setInterfaces(new Class[] { Target189.TestProxy.class });
@@ -417,7 +417,7 @@ public class ProxyTester extends TestCase {
public void testJIRA127() throws Exception {
ProxyFactory proxyFactory = new ProxyFactory();
- proxyFactory.writeDirectory = ".";
+ // proxyFactory.writeDirectory = ".";
proxyFactory.setInterfaces(new Class[]{ Target127.Sub.class });
Target127.Sub proxy = (Target127.Sub)proxyFactory.create(new Class[0], new Object[0], new MethodHandler() {
public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable {