mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-09 08:38:43 +08:00
[libgdx] SkeletonViewer, try to disable reflective access warning.
This commit is contained in:
parent
6b1e87e6bc
commit
742d11f65f
@ -34,6 +34,7 @@ import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.Thread.UncaughtExceptionHandler;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import com.badlogic.gdx.ApplicationAdapter;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
@ -1110,6 +1111,19 @@ public class SkeletonViewer extends ApplicationAdapter {
|
||||
}
|
||||
|
||||
static public void main (String[] args) throws Exception {
|
||||
try { // Try to turn off illegal access log messages.
|
||||
Class loggerClass = Class.forName("jdk.internal.module.IllegalAccessLogger");
|
||||
Field loggerField = loggerClass.getDeclaredField("logger");
|
||||
Class unsafeClass = Class.forName("sun.misc.Unsafe");
|
||||
Field unsafeField = unsafeClass.getDeclaredField("theUnsafe");
|
||||
unsafeField.setAccessible(true);
|
||||
Object unsafe = unsafeField.get(null);
|
||||
Long offset = (Long)unsafeClass.getMethod("staticFieldOffset", Field.class).invoke(unsafe, loggerField);
|
||||
unsafeClass.getMethod("putObjectVolatile", Object.class, long.class, Object.class) //
|
||||
.invoke(unsafe, loggerClass, offset, null);
|
||||
} catch (Throwable ex) {
|
||||
}
|
||||
|
||||
SkeletonViewer.args = args;
|
||||
|
||||
String os = System.getProperty("os.name");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user