aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-06-18 03:35:43 +0200
committerSven Gothel <[email protected]>2023-06-18 03:35:43 +0200
commit187c097055dc691a2ee65bed1c06c089aaf5cb59 (patch)
tree3eaf6e46c7af8b5b45f4ac17e1114d49d3aade93 /src/java/com/jogamp
parent2837fad810b66ace8d841c8a67577db442883c78 (diff)
GlueGen Struct [12]: Throw InternalError(..) for produced code-path where Ownership.Native _and_ native memory potentially gets replaced
Diffstat (limited to 'src/java/com/jogamp')
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index eee1f9d..917ff35 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -1868,6 +1868,9 @@ public class JavaEmitter implements GlueEmitter {
null, constElemCount, maxOneElement, elemCountExpr, null, null);
if( isConstValue ) {
// constElemCount/Ownership.Native excluded: SKIP setter for constValue constElemCount Pointer w/ native ownership
+ if( Ownership.Native == ownership ) {
+ throw new InternalError("Native ownership but adding potential memory-replacement for '"+returnSizeLookupName+"': "+fieldType.getSignature(null).toString());
+ }
unit.emitln(" {");
unit.emitln(" final ElementBuffer eb = ElementBuffer.allocateDirect("+primElemSizeExpr+", 1);");
unit.emit (" eb.getByteBuffer()");
@@ -1962,6 +1965,9 @@ public class JavaEmitter implements GlueEmitter {
// constElemCount/Ownership.Native excluded: SKIP setter for constValue constElemCount Pointer w/ native ownership
generateSetterSignature(unit, accessMod, false, false, fieldName, fieldType, ownership, containingJTypeName, capitalFieldName, null,
baseJElemTypeName+"[]", SetReplaceArrayArgsPost, constElemCount, maxOneElement, elemCountExpr, SetReplaceArrayApiDocDetail, SetReplaceArrayApiDocArgs);
+ if( Ownership.Native == ownership ) {
+ throw new InternalError("Native ownership but adding potential memory-replacement for '"+returnSizeLookupName+"': "+fieldType.getSignature(null).toString());
+ }
unit.emitln(" {");
unit.emitln(SetReplaceArrayArgsCheck);
unit.emitln(" final ElementBuffer eb = ElementBuffer.allocateDirect("+primElemSizeExpr+", length);");
@@ -1998,6 +2004,9 @@ public class JavaEmitter implements GlueEmitter {
} else /* if( !constElemCount && isPointer ) */ {
generateSetterSignature(unit, accessMod, false, false, fieldName, fieldType, ownership, containingJTypeName, capitalFieldName, SetArrayArgsPre,
baseJElemTypeName+"[]", SetArrayArgsPost, constElemCount, maxOneElement, elemCountExpr, SetArrayApiDocDetail, SetArrayApiDocArgs);
+ if( Ownership.Native == ownership ) {
+ throw new InternalError("Native ownership but adding potential memory-replacement for '"+returnSizeLookupName+"': "+fieldType.getSignature(null).toString());
+ }
unit.emitln(" {");
unit.emitln(SetArrayArgsCheck);
unit.emitln(" final int elemCount = "+getElemCountFuncExpr+";");
@@ -2097,6 +2106,9 @@ public class JavaEmitter implements GlueEmitter {
// constElemCount/Ownership.Native excluded: SKIP setter for constValue constElemCount Pointer w/ native ownership
generateSetterSignature(unit, accessMod, false, false, fieldName, fieldType, ownership, containingJTypeName, capitalFieldName, null,
baseJElemTypeName+"[]", SetReplaceArrayArgsPost, constElemCount, maxOneElement, elemCountExpr, SetReplaceArrayApiDocDetail, SetReplaceArrayApiDocArgs);
+ if( Ownership.Native == ownership ) {
+ throw new InternalError("Native ownership but adding potential memory-replacement for '"+returnSizeLookupName+"': "+fieldType.getSignature(null).toString());
+ }
unit.emitln(" {");
unit.emitln(SetReplaceArrayArgsCheck);
unit.emitln(" final ElementBuffer eb = ElementBuffer.allocateDirect("+baseJElemTypeName+".size(), length);");
@@ -2129,6 +2141,9 @@ public class JavaEmitter implements GlueEmitter {
} else /* if( !constElemCount && isPointer ) */ {
generateSetterSignature(unit, accessMod, false, false, fieldName, fieldType, ownership, containingJTypeName, capitalFieldName, SetArrayArgsPre,
baseJElemTypeName+"[]", SetArrayArgsPost, constElemCount, maxOneElement, elemCountExpr, SetArrayApiDocDetail, SetArrayApiDocArgs);
+ if( Ownership.Native == ownership ) {
+ throw new InternalError("Native ownership but adding potential memory-replacement for '"+returnSizeLookupName+"': "+fieldType.getSignature(null).toString());
+ }
unit.emitln(" {");
unit.emitln(SetArrayArgsCheck);
unit.emitln(" final int elemCount = "+getElemCountFuncExpr+";");