diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java index 7c49b62d7..075c8bfd8 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java @@ -465,22 +465,20 @@ public class GLEmitter extends ProcAddressEmitter { w.println(" protected boolean isFunctionAvailableImpl(String functionNameUsr) throws IllegalArgumentException {"); w.println(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);"); w.println(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;"); - w.println(" java.lang.reflect.Field addressField = null;"); - w.println(" int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);"); - w.println(" for(int i = 0; null==addressField && i < funcNamePermNum; i++) {"); - w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);"); - w.println(" addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {"); - w.println(" public java.lang.reflect.Field run() {"); + w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);"); + w.println(" final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {"); + w.println(" public final java.lang.reflect.Field run() {"); + w.println(" java.lang.reflect.Field addressField = null;"); + w.println(" for(int i = 0; i < funcNamePermNum; i++) {"); + w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);"); w.println(" try {"); - w.println(" final java.lang.reflect.Field addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );"); + w.println(" addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );"); w.println(" addressField.setAccessible(true); // we need to read the protected value!"); w.println(" return addressField;"); - w.println(" } catch (NoSuchFieldException ex) {"); - w.println(" return null;"); - w.println(" }"); + w.println(" } catch (NoSuchFieldException ex) { }"); w.println(" }"); - w.println(" } );"); - w.println(" }"); + w.println(" return null;"); + w.println(" } } );"); w.println(); w.println(" if(null==addressField) {"); w.println(" // The user is calling a bogus function or one which is not"); @@ -505,22 +503,20 @@ public class GLEmitter extends ProcAddressEmitter { w.println(" SecurityUtil.checkAllLinkPermission();"); w.println(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);"); w.println(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;"); - w.println(" java.lang.reflect.Field addressField = null;"); - w.println(" int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);"); - w.println(" for(int i = 0; null==addressField && i < funcNamePermNum; i++) {"); - w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);"); - w.println(" addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {"); - w.println(" public java.lang.reflect.Field run() {"); + w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);"); + w.println(" final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {"); + w.println(" public final java.lang.reflect.Field run() {"); + w.println(" java.lang.reflect.Field addressField = null;"); + w.println(" for(int i = 0; i < funcNamePermNum; i++) {"); + w.println(" final String addressFieldName = "+GLNameResolver.class.getName()+".getFuncNamePermutation(addressFieldNameBase, i);"); w.println(" try {"); - w.println(" final java.lang.reflect.Field addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );"); + w.println(" addressField = "+tableClassName+".class.getDeclaredField( addressFieldName );"); w.println(" addressField.setAccessible(true); // we need to read the protected value!"); w.println(" return addressField;"); - w.println(" } catch (NoSuchFieldException ex) {"); - w.println(" return null;"); - w.println(" }"); + w.println(" } catch (NoSuchFieldException ex) { }"); w.println(" }"); - w.println(" } );"); - w.println(" }"); + w.println(" return null;"); + w.println(" } } );"); w.println(); w.println(" if(null==addressField) {"); w.println(" // The user is calling a bogus function or one which is not"); |