aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/util
diff options
context:
space:
mode:
authorchibash <chiba@javassist.org>2018-12-06 11:01:55 +0900
committerchibash <chiba@javassist.org>2018-12-06 11:01:55 +0900
commit9cfa81cce09bda5c7fccf4710e8c357977bfdaf2 (patch)
treee8c45480fb705a2f185099d3a3809732187718a9 /src/main/javassist/util
parenta82e2d71bd3da248dab836f4e150ff08cc0e6915 (diff)
downloadjavassist-9cfa81cce09bda5c7fccf4710e8c357977bfdaf2.tar.gz
javassist-9cfa81cce09bda5c7fccf4710e8c357977bfdaf2.zip
fixes another bug (supporting jdk.*) reported in #228
Diffstat (limited to 'src/main/javassist/util')
-rw-r--r--src/main/javassist/util/proxy/ProxyFactory.java11
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);
}