diff --git a/stream-core/src/main/java/org/dromara/streamquery/stream/core/reflect/ReflectHelper.java b/stream-core/src/main/java/org/dromara/streamquery/stream/core/reflect/ReflectHelper.java index 37c1a4186..9c5f9b7cf 100644 --- a/stream-core/src/main/java/org/dromara/streamquery/stream/core/reflect/ReflectHelper.java +++ b/stream-core/src/main/java/org/dromara/streamquery/stream/core/reflect/ReflectHelper.java @@ -17,6 +17,7 @@ package org.dromara.streamquery.stream.core.reflect; import org.dromara.streamquery.stream.core.collection.Maps; +import org.dromara.streamquery.stream.core.enums.JreEnum; import org.dromara.streamquery.stream.core.lambda.function.SerFunc; import org.dromara.streamquery.stream.core.lambda.function.SerPred; import org.dromara.streamquery.stream.core.optional.Opp; @@ -69,12 +70,17 @@ private ReflectHelper() { if (accessibleObject.isAccessible()) { return accessibleObject; } - return AccessController.doPrivileged( - (PrivilegedAction<$ACCESSIBLE_OBJECT>) - () -> { - accessibleObject.setAccessible(true); - return accessibleObject; - }); + + final Opp<$ACCESSIBLE_OBJECT> $ACCESSIBLEObjectOpp = Opp.ofTry(() -> AccessController.doPrivileged( + (PrivilegedAction<$ACCESSIBLE_OBJECT>) + () -> { + accessibleObject.setAccessible(true); + return accessibleObject; + })); + + final String jdkVersion = JreEnum.currentVersion().name(); + return $ACCESSIBLEObjectOpp.orElseThrow(() -> new RuntimeException("当前JDK版本" + jdkVersion + "进行了模块化管理,可以手动修改JVM启动参数来解决,如:--add-opens java.base/java.util=ALL-UNNAMED --add-opens\n" + + " java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED")); } /**