diff options
author | chibash <chiba@javassist.org> | 2018-09-02 19:25:12 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2018-09-02 19:25:12 +0900 |
commit | a13f51b8d12510152bffe1fc7bd1f4a1ca16fefb (patch) | |
tree | 8ad2779b81118ccdfcb3fc893266004aee61ff99 /src/test | |
parent | bca5c7aad8551aebda6039fb74b41c20de3d23d9 (diff) | |
download | javassist-a13f51b8d12510152bffe1fc7bd1f4a1ca16fefb.tar.gz javassist-a13f51b8d12510152bffe1fc7bd1f4a1ca16fefb.zip |
adds a comment for the fix to JIRA JASSIST-267
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test/javassist/proxy/ProxySimpleTest.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/test/javassist/proxy/ProxySimpleTest.java b/src/test/test/javassist/proxy/ProxySimpleTest.java index 76178a7e..63298501 100644 --- a/src/test/test/javassist/proxy/ProxySimpleTest.java +++ b/src/test/test/javassist/proxy/ProxySimpleTest.java @@ -330,5 +330,36 @@ public class ProxySimpleTest extends TestCase { public static class Extended267 extends Base267 { public String base(Integer i) { return "extended" + i + i; } } + + String value267b; + public void testJIRA267b() throws Exception { + Extended267b extended267 = new Extended267b(); + ProxyFactory factory = new ProxyFactory(); + factory.setSuperclass(Extended267b.class); + Extended267b e = (Extended267b)factory.create(null, null, new MethodHandler() { + @Override + public Object invoke(Object self, Method thisMethod, + Method proceed, Object[] args) throws Throwable { + value267b += thisMethod.getDeclaringClass().getName(); + value267b += ";" + thisMethod.getReturnType().getName(); + return proceed.invoke(self, args); + } + }); + + value267b = ""; + assertEquals("extended", e.base()); + System.out.println(value267b); + assertEquals(Extended267b.class.getName() + ";" + String.class.getName(), value267b); + } + + public static class Base267b { + public Object base() { return "base"; } + } + + // Extended267b has a bridge method for base():Object, + // since Extended267b#base() is covariant. + public static class Extended267b extends Base267b { + public String base() { return "extended"; } + } } |