aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorMathieu Féry <[email protected]>2023-08-04 19:37:14 +0200
committerMathieu Féry <[email protected]>2023-08-04 19:37:48 +0200
commit2abb40b0ca9a6a06bdbe3e66b4235301ed15c693 (patch)
tree2d95e75c5d670712aa9551eeabba93be44213ad5 /src/java
parent9b0335ea91c39469b586b4005dfae35d4b2cc84b (diff)
wip(test_case): Example of test case for issue related of 927bbc7160a812bb29c0e7120d4a3009bfb13bbf
Almost done
Diffstat (limited to 'src/java')
-rw-r--r--src/java/com/jogamp/gluegen/JavaCallbackEmitter.java2
-rw-r--r--src/java/com/jogamp/gluegen/JavaConfiguration.java10
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java70
3 files changed, 51 insertions, 31 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java b/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java
index 01ffe8f..3359c1c 100644
--- a/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaCallbackEmitter.java
@@ -348,6 +348,8 @@ public final class JavaCallbackEmitter {
}
private final void emitJavaKeyClass(final CodeUnit unit) {
+ if( cfg.shouldIgnoreInInterface(KeyClassName) ) return;
+
emitJavaBriefAPIDoc(unit, "", "", "", "for ");
unit.emitln(" public static class "+KeyClassName+" {");
binding.forEachParameter( ( final int idx, final int consumedCount, final Type cType, final JavaType jType, final String name ) -> {
diff --git a/src/java/com/jogamp/gluegen/JavaConfiguration.java b/src/java/com/jogamp/gluegen/JavaConfiguration.java
index 107b8c3..870b708 100644
--- a/src/java/com/jogamp/gluegen/JavaConfiguration.java
+++ b/src/java/com/jogamp/gluegen/JavaConfiguration.java
@@ -1808,23 +1808,33 @@ public class JavaConfiguration {
final Set<String> parsedEnumNames = parser.getParsedEnumNames();
final Set<String> parsedFuncNames = parser.getParsedFunctionNames();
+ final Set<String> parsedInnerInterfaces = parser.getParsedInnerInterfacesNames();
+ final Set<String> parsedInnerClasses = parser.getParsedInnerClassesNames();
if(forInterface) {
if(onlyList) {
extendedIntfSymbolsOnly.addAll(parsedEnumNames);
extendedIntfSymbolsOnly.addAll(parsedFuncNames);
+ extendedIntfSymbolsOnly.addAll(parsedInnerInterfaces);
+ extendedIntfSymbolsOnly.addAll(parsedInnerClasses);
} else {
extendedIntfSymbolsIgnore.addAll(parsedEnumNames);
extendedIntfSymbolsIgnore.addAll(parsedFuncNames);
+ extendedIntfSymbolsIgnore.addAll(parsedInnerInterfaces);
+ extendedIntfSymbolsIgnore.addAll(parsedInnerClasses);
}
}
if(forImplementation) {
if(onlyList) {
extendedImplSymbolsOnly.addAll(parsedEnumNames);
extendedImplSymbolsOnly.addAll(parsedFuncNames);
+ extendedImplSymbolsOnly.addAll(parsedInnerInterfaces);
+ extendedImplSymbolsOnly.addAll(parsedInnerClasses);
} else {
extendedImplSymbolsIgnore.addAll(parsedEnumNames);
extendedImplSymbolsIgnore.addAll(parsedFuncNames);
+ extendedImplSymbolsIgnore.addAll(parsedInnerInterfaces);
+ extendedImplSymbolsIgnore.addAll(parsedInnerClasses);
}
}
}
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index 0936536..6e79b6c 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -1494,11 +1494,17 @@ public class JavaEmitter implements GlueEmitter {
LOG.log(INFO, "JavaCallbackInfo: Reusing {0} -> {1}", jcbd.setFuncName, jcbi0);
} else {
final StringBuilder cbMethodSignature = new StringBuilder();
- javaUnit.emitln(" /** JavaCallback interface: "+jcbd.cbFuncTypeName+" -> "+funcType.toString(jcbd.cbFuncTypeName, false, true)+" */");
- javaUnit.emitln(" public static interface "+cbSimpleClazzName+" {");
- final List<MethodBinding> mbs = generateFunctionInterfaceCode(javaUnit, funcSym, jcbd, cbMethodSignature);
- javaUnit.emitln(" }");
- javaUnit.emitln();
+ final List<MethodBinding> mbs;
+ if( !cfg.shouldIgnoreInInterface(jcbd.cbFuncTypeName) ) {
+ javaUnit.emitln(" /** JavaCallback interface: "+jcbd.cbFuncTypeName+" -> "+funcType.toString(jcbd.cbFuncTypeName, false, true)+" */");
+ javaUnit.emitln(" public static interface "+cbSimpleClazzName+" {");
+ mbs = generateFunctionInterfaceCode(javaUnit, funcSym, jcbd, cbMethodSignature);
+ javaUnit.emitln(" }");
+ javaUnit.emitln();
+ } else {
+ LOG.log(WARNING, "JavaCallbackInfo: Java Configuration indicate current JavaCallback must be ignored so assume JavaCallback meet presents requirements of {0}", jcbd.setFuncName);
+ mbs = generateFunctionInterfaceCode(null, funcSym, jcbd, cbMethodSignature);
+ }
if( 1 != mbs.size() ) {
throw new UnsupportedOperationException("Multiple bindings generated where only 1 is allowed for func "+funcType.toString(jcbd.cbFuncTypeName, false, true));
}
@@ -1508,9 +1514,9 @@ public class JavaEmitter implements GlueEmitter {
cbFuncBinding.getJavaReturnType()+", func "+funcType.toString(jcbd.cbFuncTypeName, false, true));
}
final JavaCallbackInfo jcbi1 = new JavaCallbackInfo(jcbd.cbFuncTypeName, cbSimpleClazzName, cbFQClazzName, cbMethodSignature.toString(),
- funcType, cbFuncBinding, jcbd.cbFuncUserParamIdx, jcbd.cbFuncKeyIndices,
- jcbd.setFuncName, jcbd.setFuncUserParamIdx, jcbd.setFuncKeyIndices,
- jcbd.userParamClassName, jcbd.customKeyClassName);
+ funcType, cbFuncBinding, jcbd.cbFuncUserParamIdx, jcbd.cbFuncKeyIndices,
+ jcbd.setFuncName, jcbd.setFuncUserParamIdx, jcbd.setFuncKeyIndices,
+ jcbd.userParamClassName, jcbd.customKeyClassName);
cfg.setFuncToJavaCallbackMap.put(jcbd.setFuncName, jcbi1);
javaCallbackInterfaceMap.put(cbFQClazzName, jcbi1);
LOG.log(INFO, "JavaCallbackInfo: Added {0} -> {1}", jcbd.setFuncName, jcbi1);
@@ -1556,29 +1562,31 @@ public class JavaEmitter implements GlueEmitter {
final boolean useNIOOnly = true;
final boolean useNIODirectOnly = true;
- for (final MethodBinding binding : bindings) {
- // Emit public Java entry point for calling this function pointer
- final JavaMethodBindingEmitter emitter = new JavaMethodBindingEmitter(binding,
- javaUnit,
- cfg.runtimeExceptionType(),
- cfg.unsupportedExceptionType(),
- false, // emitBody
- cfg.tagNativeBinding(),
- false, // eraseBufferAndArrayTypes
- useNIOOnly,
- useNIODirectOnly,
- false, // forDirectBufferImplementation
- false, // forIndirectBufferAndArrayImplementation
- true, // isUnimplemented
- true, // isInterface
- false, // isNativeMethod
- false, // isPrivateNativeMethod
- cfg) {
- @Override
- protected String getBaseIndentString() { return " "; }
- };
- emitter.addModifier(JavaMethodBindingEmitter.PUBLIC);
- emitter.emit();
+ if( null != javaUnit) {
+ for (final MethodBinding binding : bindings) {
+ // Emit public Java entry point for calling this function pointer
+ final JavaMethodBindingEmitter emitter = new JavaMethodBindingEmitter(binding,
+ javaUnit,
+ cfg.runtimeExceptionType(),
+ cfg.unsupportedExceptionType(),
+ false, // emitBody
+ cfg.tagNativeBinding(),
+ false, // eraseBufferAndArrayTypes
+ useNIOOnly,
+ useNIODirectOnly,
+ false, // forDirectBufferImplementation
+ false, // forIndirectBufferAndArrayImplementation
+ true, // isUnimplemented
+ true, // isInterface
+ false, // isNativeMethod
+ false, // isPrivateNativeMethod
+ cfg) {
+ @Override
+ protected String getBaseIndentString() { return " "; }
+ };
+ emitter.addModifier(JavaMethodBindingEmitter.PUBLIC);
+ emitter.emit();
+ }
}
return bindings;
}