diff options
author | Sven Gothel <[email protected]> | 2019-09-04 04:23:49 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-09-04 04:23:49 +0200 |
commit | b90fcb88cf208dad27402256e4f08659b17ba567 (patch) | |
tree | c88f8a69e633d4faf2e09b41bb7bdb67ee0b094b /src/nativewindow/classes/com/jogamp | |
parent | c5431f46b7bf64f109315ec78461859dd88f202a (diff) |
Bug 1363: Java 11: Utilize UnsafeUtil.doWithoutIllegalAccessLogger(..) avoiding further unnecessary warnings
Access to said internal non-exported methods is essential.
See commit c5431f46b7bf64f109315ec78461859dd88f202a.
Further added verbose DEBUG output where applicable.
Diffstat (limited to 'src/nativewindow/classes/com/jogamp')
-rw-r--r-- | src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java index e5dcfa1c0..8189f6262 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AppContextInfo.java @@ -5,7 +5,9 @@ import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; +import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.RunnableTask; +import com.jogamp.common.util.UnsafeUtil; import jogamp.nativewindow.jawt.JAWTUtil; @@ -29,15 +31,18 @@ public class AppContextInfo { AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { - try { - final Class<?> appContextClass = Class.forName("sun.awt.AppContext"); - _getAppContextMethod[0] = appContextClass.getMethod("getAppContext"); - } catch(final Throwable ex) { - System.err.println("Bug 1004: Caught @ static: "+ex.getMessage()); - ex.printStackTrace(); - } - return null; - } } ); + return UnsafeUtil.doWithoutIllegalAccessLogger(new PrivilegedAction<Object>() { + @Override + public Object run() { + try { + final Class<?> appContextClass = Class.forName("sun.awt.AppContext"); + _getAppContextMethod[0] = appContextClass.getMethod("getAppContext"); + _getAppContextMethod[0].setAccessible(true); + } catch(final Throwable ex) { + ExceptionUtils.dumpThrowable("AppContextInfo(Bug 1004)", ex); + } + return null; + }}); }}); getAppContextMethod = _getAppContextMethod[0]; } @@ -185,8 +190,7 @@ public class AppContextInfo { try { return getAppContextMethod.invoke(null); } catch(final Exception ex) { - System.err.println("Bug 1004: Caught: "+ex.getMessage()); - ex.printStackTrace(); + ExceptionUtils.dumpThrowable("AppContextInfo(Bug 1004)", ex); return null; } } |