diff options
author | Sven Gothel <[email protected]> | 2023-07-02 05:34:13 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-07-02 05:34:13 +0200 |
commit | e999ece8b0cd2ec440314f9a4c20812c694991ae (patch) | |
tree | 8b03b8905e5bb3709d68805a98a3f60abba99551 /src/java/com | |
parent | 1caceb4e72b2e99c5c458d37ebced0c51fe6bb70 (diff) |
GlueGen Struct [18]: Drop redundant 'static get*ElemCount() { return 1 }` for: isPrimitive && !isPointer && staticElemCount && maxOneElement
Diffstat (limited to 'src/java/com')
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaEmitter.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index c00d2ed..64aaa8a 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -1957,8 +1957,10 @@ public class JavaEmitter implements GlueEmitter { // if( ownElemCountHandling ) { if( constElemCount ) { - generateGetterSignature(unit, staticElemCount, false, fieldName, fieldType, ownership, "int", capitalFieldName+"ElemCount", null, constElemCount, maxOneElement, elemCountExpr, GetElemCountApiDocTail); - unit.emitln(" { return "+elemCountExpr+"; }"); + if( !( isPrimitive && !isPointer && staticElemCount && maxOneElement ) ) { // drop useless `static get*ElemCount() { return 1; }` + generateGetterSignature(unit, staticElemCount, false, fieldName, fieldType, ownership, "int", capitalFieldName+"ElemCount", null, constElemCount, maxOneElement, elemCountExpr, GetElemCountApiDocTail); + unit.emitln(" { return "+elemCountExpr+"; }"); + } } else if( useGetCStringLength ) { generateGetterSignature(unit, staticElemCount, false, fieldName, fieldType, ownership, "int", capitalFieldName+"ElemCount", null, constElemCount, maxOneElement, elemCountExpr, GetElemCountApiDocTail); unit.emitln(" {"); |