aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--javassist.jarbin766391 -> 766400 bytes
-rw-r--r--src/main/javassist/util/proxy/ProxyFactory.java4
-rw-r--r--src/test/javassist/proxyfactory/ProxyFactoryTest.java12
3 files changed, 15 insertions, 1 deletions
diff --git a/javassist.jar b/javassist.jar
index a4781002..3099d18a 100644
--- a/javassist.jar
+++ b/javassist.jar
Binary files differ
diff --git a/src/main/javassist/util/proxy/ProxyFactory.java b/src/main/javassist/util/proxy/ProxyFactory.java
index 0c39a508..55f13059 100644
--- a/src/main/javassist/util/proxy/ProxyFactory.java
+++ b/src/main/javassist/util/proxy/ProxyFactory.java
@@ -622,7 +622,9 @@ public class ProxyFactory {
* {@code java.lang.invoke.MethodHandles.Lookup}.
*/
private Class<?> getClassInTheSamePackage() {
- if (superClass != null && superClass != OBJECT_TYPE)
+ if (basename.startsWith("javassist.util.proxy.")) // maybe the super class is java.*
+ return this.getClass();
+ else if (superClass != null && superClass != OBJECT_TYPE)
return superClass;
else if (interfaces != null && interfaces.length > 0)
return interfaces[0];
diff --git a/src/test/javassist/proxyfactory/ProxyFactoryTest.java b/src/test/javassist/proxyfactory/ProxyFactoryTest.java
index 3189b568..43a96bb6 100644
--- a/src/test/javassist/proxyfactory/ProxyFactoryTest.java
+++ b/src/test/javassist/proxyfactory/ProxyFactoryTest.java
@@ -128,4 +128,16 @@ public class ProxyFactoryTest extends TestCase {
public static class TestDefaultC2 extends TestDefaultC {
public int baz() { return super.foo(); }
}
+
+ public void testJava11() throws Exception {
+ ProxyFactory factory = new ProxyFactory();
+ factory.setSuperclass(java.util.HashMap.class);
+ java.util.HashMap e = (java.util.HashMap)factory.create(null, null, new MethodHandler() {
+ @Override
+ public Object invoke(Object self, Method thisMethod,
+ Method proceed, Object[] args) throws Throwable {
+ return proceed.invoke(self, args);
+ }
+ });
+ }
}