Document limitations of CGLIB proxy class generation in JPMS module setups

Includes extended exception messages with common hints and explanations.

Closes gh-32671
This commit is contained in:
Juergen Hoeller
2024-05-08 17:51:17 +02:00
parent 6250b64766
commit 0eb937a866
3 changed files with 27 additions and 6 deletions

View File

@@ -544,7 +544,15 @@ public class ReflectUtils {
// No defineClass variant available at all?
if (c == null) {
throw new CodeGenerationException(t);
throw new CodeGenerationException(t) {
@Override
public String getMessage() {
return "No compatible defineClass mechanism detected: " +
"JVM should be started with --add-opens=java.base/java.lang=ALL-UNNAMED " +
"for ClassLoader.defineClass to be accessible. On the module path, " +
"you may not be able to define this CGLIB-generated class at all.";
}
};
}
// Force static initializers to run.