Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void disableIllegalWarning() {
- try {
- Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
- theUnsafe.setAccessible(true);
- Unsafe u = (Unsafe) theUnsafe.get(null);
- Class cls = Class.forName("jdk.internal.module.IllegalAccessLogger");
- Field logger = cls.getDeclaredField("logger");
- u.putObjectVolatile(cls, u.staticFieldOffset(logger), null);
- } catch (Exception e) {
- // ignore
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement