diff options
Diffstat (limited to 'src/main/javassist/util/proxy/ProxyFactory.java')
-rw-r--r-- | src/main/javassist/util/proxy/ProxyFactory.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/main/javassist/util/proxy/ProxyFactory.java b/src/main/javassist/util/proxy/ProxyFactory.java index 55f13059..ae368b2a 100644 --- a/src/main/javassist/util/proxy/ProxyFactory.java +++ b/src/main/javassist/util/proxy/ProxyFactory.java @@ -622,7 +622,7 @@ public class ProxyFactory { * {@code java.lang.invoke.MethodHandles.Lookup}. */ private Class<?> getClassInTheSamePackage() { - if (basename.startsWith("javassist.util.proxy.")) // maybe the super class is java.* + if (basename.startsWith(packageForJavaBase)) // maybe the super class is java.* return this.getClass(); else if (superClass != null && superClass != OBJECT_TYPE) return superClass; @@ -921,10 +921,15 @@ public class ProxyFactory { if (Modifier.isFinal(superClass.getModifiers())) throw new RuntimeException(superName + " is final"); - if (basename.startsWith("java.") || onlyPublicMethods) - basename = "javassist.util.proxy." + basename.replace('.', '_'); + // Since java.base module is not opened, its proxy class should be + // in a different (open) module. Otherwise, it could not be created + // by reflection. + if (basename.startsWith("java.") || basename.startsWith("jdk.") || onlyPublicMethods) + basename = packageForJavaBase + basename.replace('.', '_'); } + private static final String packageForJavaBase = "javassist.util.proxy."; + private void allocateClassName() { classname = makeProxyName(basename); } |