Browse Source

adds a comment for the fix to JIRA JASSIST-267

tags/rel_3_24_0_rc
chibash 5 years ago
parent
commit
a13f51b8d1

+ 6
- 0
Readme.html View File

@@ -281,6 +281,12 @@ see javassist.Dump.

<h2>Changes</h2>

<p>-version 3.24
<ul>
<li>JIRA JASSIST-267.
</ul>
</p>

<p>-version 3.23.1 on July 2, 2018
<ul>
<li>Github pull issue #171.</li>

BIN
javassist.jar View File


+ 2
- 2
src/main/javassist/util/proxy/ProxyFactory.java View File

@@ -1186,8 +1186,8 @@ public class ProxyFactory {
// put the method to the cache, retrieve previous definition (if any)
Method oldMethod = hash.put(key, m);

// JIRA JASSIST-244
// ignore a bridge method with the same signature that the overridden one has.
// JIRA JASSIST-244, 267
// ignore a bridge method to a method declared in a non-public class.
if (null != oldMethod && isBridge(m)
&& !Modifier.isPublic(oldMethod.getDeclaringClass().getModifiers())
&& !Modifier.isAbstract(oldMethod.getModifiers()) && !isDuplicated(i, methods))

+ 31
- 0
src/test/test/javassist/proxy/ProxySimpleTest.java View File

@@ -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"; }
}
}

Loading…
Cancel
Save