aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-06-16 05:32:07 +0200
committerSven Gothel <[email protected]>2023-06-16 05:32:07 +0200
commit88309192b450e09ba16e9d72adac178c4ce47dc3 (patch)
tree9ee1da74fa3ecc533f1836385c3f3d6a3df7ff86
parentfdccf16290c7b742337d3f7ab66e4b85660ca781 (diff)
GlueGen Struct [6]: Simplify adding 'private ElementBuffer _eb*' memory buffer cache once @ 'releaseVal(..)' code creation
-rw-r--r--make/build-test.xml4
-rw-r--r--src/java/com/jogamp/gluegen/JavaEmitter.java30
2 files changed, 5 insertions, 29 deletions
diff --git a/make/build-test.xml b/make/build-test.xml
index 3a72ebd..6c4c3a1 100644
--- a/make/build-test.xml
+++ b/make/build-test.xml
@@ -563,8 +563,8 @@ chmod 644 ${results}/* \${line.separator}
includeRefid="stub.includes.fileset.test"
emitter="com.jogamp.gluegen.JavaEmitter"
dumpCPP="false"
- debug="true"
- logLevel="INFO">
+ debug="false"
+ logLevel="WARNING">
<classpath refid="gluegen.classpath" />
</gluegen>
<antcall target="java.generate.copy2temp" inheritRefs="true" />
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java
index e2be4ea..ada1ce9 100644
--- a/src/java/com/jogamp/gluegen/JavaEmitter.java
+++ b/src/java/com/jogamp/gluegen/JavaEmitter.java
@@ -1700,6 +1700,8 @@ public class JavaEmitter implements GlueEmitter {
emitSetElemCount(unit, setElemCountLengthFunc, "0", !useGetCStringLength, capitalFieldName, structCType, " ");
unit.emitln(" return this;");
unit.emitln(" }");
+ unit.emitln(" @SuppressWarnings(\"unused\")");
+ unit.emitln(" private ElementBuffer _eb"+capitalFieldName+"; // cache new memory buffer ensuring same lifecycle");
unit.emitln();
}
}
@@ -1734,8 +1736,6 @@ public class JavaEmitter implements GlueEmitter {
emitSetElemCount(unit, setElemCountLengthFunc, "1", !useGetCStringLength, capitalFieldName, structCType, " ");
unit.emitln(" return this;");
unit.emitln(" }");
- unit.emitln(" @SuppressWarnings(\"unused\")");
- unit.emitln(" private ElementBuffer _eb"+capitalFieldName+"; // cache new memory buffer ensuring same lifecycle");
} else {
unit.emitln(" {");
unit.emitln(" final int elemCount = "+getElemCountFuncExpr+";");
@@ -1765,8 +1765,6 @@ public class JavaEmitter implements GlueEmitter {
unit.emitln(" }");
unit.emitln(" return this;");
unit.emitln(" }");
- unit.emitln(" @SuppressWarnings(\"unused\")");
- unit.emitln(" private ElementBuffer _eb"+capitalFieldName+"; // cache new memory buffer ensuring same lifecycle");
}
}
} else { // array && !isConstValue
@@ -1784,7 +1782,6 @@ public class JavaEmitter implements GlueEmitter {
unit.emitln();
} else {
// Setter Primitive n Pointer + Array
- boolean addedElementBufferCache = false;
boolean doneString = false;
if( isString && isByteBuffer && isPointer ) { // isConst is OK
@@ -1807,13 +1804,8 @@ public class JavaEmitter implements GlueEmitter {
}
unit.emitln(" return this;");
unit.emitln(" }");
- if( !constElemCount ) {
- unit.emitln(" @SuppressWarnings(\"unused\")");
- unit.emitln(" private ElementBuffer _eb"+capitalFieldName+"; // cache new memory buffer ensuring same lifecycle");
- addedElementBufferCache = true;
- doneString = true;
- }
unit.emitln();
+ doneString = true;
}
if( doneString && isStringOnly ) {
generateSetterAPIDoc(unit, "SKIP setter for String alternative (ByteBuffer)", fieldType, fieldName, constElemCount, elemCountExpr);
@@ -1835,10 +1827,6 @@ public class JavaEmitter implements GlueEmitter {
emitSetElemCount(unit, setElemCountLengthFunc, "newElemCount", !useGetCStringLength, capitalFieldName, structCType, " ");
unit.emitln(" return this;");
unit.emitln(" }");
- if( !addedElementBufferCache ) {
- unit.emitln(" @SuppressWarnings(\"unused\")");
- unit.emitln(" private ElementBuffer _eb"+capitalFieldName+"; // cache new memory buffer ensuring same lifecycle");
- }
} // else SKIP setter for constValue Array
} else if( constElemCount || !isPointer ) {
generateSetterSignature(unit, fieldType, accessMod, false, false, containingJTypeName, fieldName, capitalFieldName, null, baseJElemTypeName+"[]", SetArrayArgs, constElemCount, elemCountExpr);
@@ -1884,10 +1872,6 @@ public class JavaEmitter implements GlueEmitter {
unit.emitln(" }");
unit.emitln(" return this;");
unit.emitln(" }");
- if( !addedElementBufferCache ) {
- unit.emitln(" @SuppressWarnings(\"unused\")");
- unit.emitln(" private ElementBuffer _eb"+capitalFieldName+"; // cache new memory buffer ensuring same lifecycle");
- }
}
unit.emitln();
}
@@ -1907,8 +1891,6 @@ public class JavaEmitter implements GlueEmitter {
emitSetElemCount(unit, setElemCountLengthFunc, "1", !useGetCStringLength, capitalFieldName, structCType, " ");
unit.emitln(" return this;");
unit.emitln(" }");
- unit.emitln(" @SuppressWarnings(\"unused\")");
- unit.emitln(" private ElementBuffer _eb"+capitalFieldName+"; // cache new memory buffer ensuring same lifecycle");
} else {
unit.emitln(" {");
unit.emitln(" final int elemCount = "+getElemCountFuncExpr+";");
@@ -1930,8 +1912,6 @@ public class JavaEmitter implements GlueEmitter {
unit.emitln(" }");
unit.emitln(" return this;");
unit.emitln(" }");
- unit.emitln(" @SuppressWarnings(\"unused\")");
- unit.emitln(" private ElementBuffer _eb"+capitalFieldName+"; // cache new memory buffer ensuring same lifecycle");
}
}
} else if( !isConstValue ) { // array && !isConstValue
@@ -1961,8 +1941,6 @@ public class JavaEmitter implements GlueEmitter {
emitSetElemCount(unit, setElemCountLengthFunc, "newElemCount", !useGetCStringLength, capitalFieldName, structCType, " ");
unit.emitln(" return this;");
unit.emitln(" }");
- unit.emitln(" @SuppressWarnings(\"unused\")");
- unit.emitln(" private ElementBuffer _eb"+capitalFieldName+"; // cache new memory buffer ensuring same lifecycle");
} // else SKIP setter for constValue Array
} else if( constElemCount || !isPointer ) {
generateSetterSignature(unit, fieldType, accessMod, false, false, containingJTypeName, fieldName, capitalFieldName, null, baseJElemTypeName+"[]", SetArrayArgs, constElemCount, elemCountExpr);
@@ -2002,8 +1980,6 @@ public class JavaEmitter implements GlueEmitter {
unit.emitln(" }");
unit.emitln(" return this;");
unit.emitln(" }");
- unit.emitln(" @SuppressWarnings(\"unused\")");
- unit.emitln(" private ElementBuffer _eb"+capitalFieldName+"; // cache new memory buffer ensuring same lifecycle");
}
unit.emitln();
if( !isConstValue ) {