Skip to content

Commit

Permalink
fix_20231124_适配JDK17用户操作提示_zangzang
Browse files Browse the repository at this point in the history
  • Loading branch information
CiZaii committed Nov 24, 2023
1 parent ebd5376 commit 96fbf4d
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
}

/**
Expand Down

0 comments on commit 96fbf4d

Please sign in to comment.