From e999ece8b0cd2ec440314f9a4c20812c694991ae Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 2 Jul 2023 05:34:13 +0200 Subject: GlueGen Struct [18]: Drop redundant 'static get*ElemCount() { return 1 }` for: isPrimitive && !isPointer && staticElemCount && maxOneElement --- src/java/com/jogamp/gluegen/JavaEmitter.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/java') 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(" {"); -- cgit v1.2.3