So the problem here is that JDK 12 changed our options around class defining again, namely disallowed us to use {{Unsafe}} to crack open {{ClassLoader}} methods. It's known problem, the issues you linked are part of it. Weld itself however does [ the same thing as classfilewriter |https://github.com/weld/core/blob/3.1.0.Beta1/impl/src/main/java/org/jboss/weld/util/bytecode/ClassFileUtils.java#L46-L73] hence is a source of these problems as well. There is a similar issue under WELD-2556 which I created and where I have a "fix" for this in EE servers.
Though your problem is in SE or servlet where Weld has to define classes. In such case I do not yet know how to fix it. JDK 12 disallows us to anyhow use CL's {{defineClass()}} methods but using {{MethodHandles.Lookup}} isn't sufficient either.
NOTE: What still works (but who knows how long) is using {{setAccessible()}} but in that case, warnings are shown which isn't nice. WELD-2556 actually does just that as a fallback. We need better solution though. |
|