summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl
diff options
context:
space:
mode:
authorWade Walker <[email protected]>2019-01-04 09:51:44 -0600
committerSven Gothel <[email protected]>2019-08-19 12:00:13 +0200
commite1c8add69973b0eae9a87cf2181a0f1cbbe62f4b (patch)
tree662a1870d2401400c61af488a75728a82d76689e /src/jogl/classes/jogamp/opengl
parentddd64dc3eb0172654aff5a4c61a389b23d92d0e3 (diff)
Removed illegal reflective access to sun.java2d.opengl.OGLUtilities
We were reading a variety of surface type definitions from sun.java2d.opengl.OGLUtilities using reflection, which has thrown warnings since Java 9 and which soon will become illegal. For now, just hard-coded these types to remove the warnings that happen during static initialization. Eventually the entire Java2D class will have to be revamped if we want to be able to actually use it.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r--src/jogl/classes/jogamp/opengl/awt/Java2D.java39
1 files changed, 8 insertions, 31 deletions
diff --git a/src/jogl/classes/jogamp/opengl/awt/Java2D.java b/src/jogl/classes/jogamp/opengl/awt/Java2D.java
index f8826f23d..7f6c48ee2 100644
--- a/src/jogl/classes/jogamp/opengl/awt/Java2D.java
+++ b/src/jogl/classes/jogamp/opengl/awt/Java2D.java
@@ -87,12 +87,14 @@ public class Java2D {
private static Method getOGLSurfaceTypeMethod;
// Publicly-visible constants for OpenGL surface types
- public static final int UNDEFINED = getOGLUtilitiesIntField("UNDEFINED");
- public static final int WINDOW = getOGLUtilitiesIntField("WINDOW");
- public static final int PBUFFER = getOGLUtilitiesIntField("PBUFFER");
- public static final int TEXTURE = getOGLUtilitiesIntField("TEXTURE");
- public static final int FLIP_BACKBUFFER = getOGLUtilitiesIntField("FLIP_BACKBUFFER");
- public static final int FBOBJECT = getOGLUtilitiesIntField("FBOBJECT");
+ // Used to determine these by reflection, but in Java 9+ that's illegal, so had to just
+ // hard-code these from sun.java2d.pipe.hw.AccelSurface.
+ public static final int UNDEFINED = 0;
+ public static final int WINDOW = 1;
+ public static final int PBUFFER = 2; // this one doesn't even seem to exist in current versions of AccelSurface
+ public static final int TEXTURE = 3;
+ public static final int FLIP_BACKBUFFER = 4;
+ public static final int FBOBJECT = 5;
// If FBOs are enabled in the Java2D/OpenGL pipeline, all contexts
// created by JOGL must share textures and display lists with the
@@ -565,31 +567,6 @@ public class Java2D {
}
}
- private static int getOGLUtilitiesIntField(final String name) {
- final Integer i = AccessController.doPrivileged(new PrivilegedAction<Integer>() {
- @Override
- public Integer run() {
- try {
- final Class<?> utils = Class.forName("sun.java2d.opengl.OGLUtilities");
- final Field f = utils.getField(name);
- f.setAccessible(true);
- return (Integer) f.get(null);
- } catch (final Exception e) {
- if (DEBUG) {
- e.printStackTrace();
- }
- return null;
- }
- }
- });
- if (i == null)
- return 0;
- if (DEBUG) {
- System.err.println("OGLUtilities." + name + " = " + i.intValue());
- }
- return i.intValue();
- }
-
private static void initFBOShareContext(final GraphicsDevice device) {
// Note 1: this must not be done in the static initalizer due to
// deadlock problems.