diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaEmitter.java | 6 | ||||
-rw-r--r-- | src/junit/com/jogamp/gluegen/test/junit/generation/Test2FuncPtr.java | 2 |
2 files changed, 5 insertions, 3 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(" {"); diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2FuncPtr.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2FuncPtr.java index cf32eb7..915b3eb 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test2FuncPtr.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test2FuncPtr.java @@ -96,7 +96,7 @@ public class Test2FuncPtr extends BaseClass { Assert.assertNotEquals(0, options.getCustomFuncB1()); Assert.assertNotEquals(0, options.getCustomFuncB2()); Assert.assertEquals(1, options.getApiVersion()); - Assert.assertEquals(1, T2_InitializeOptions.getReserved1ElemCount()); + // dropped: Assert.assertEquals(1, T2_InitializeOptions.getReserved1ElemCount()); BaseClass.assertAPTR(0x0000CAFFEEBEEFL, options.getReserved1()); { options.setReserved1(0xBEEFCAFFEE0DADL); |