diff options
author | Sven Gothel <[email protected]> | 2023-08-04 20:34:57 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-08-04 20:34:57 +0200 |
commit | 6dce08b3410cf7f6a1848f814496c5e8c2e1ff73 (patch) | |
tree | c2ffe9c74ea09f1a6fd632340e952dcb66ed4a50 /src | |
parent | 4a8f15d29120e7744eca75f6d99bae6a7431749e (diff) | |
parent | 9bf13be7d8a144be18dd313e8ed7658f25b9c1d0 (diff) |
Merge remote-tracking branch 'Mathieu_Fery/feat/array_accessor_with_getter_of_field_in_pascal_case'
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/jogamp/gluegen/JavaEmitter.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/java/com/jogamp/gluegen/JavaEmitter.java b/src/java/com/jogamp/gluegen/JavaEmitter.java index 1f1f8af..fb310a9 100644 --- a/src/java/com/jogamp/gluegen/JavaEmitter.java +++ b/src/java/com/jogamp/gluegen/JavaEmitter.java @@ -1869,11 +1869,22 @@ public class JavaEmitter implements GlueEmitter { if( !_constElemCount ) { // check for const length field if( elemCountExpr.startsWith("get") && elemCountExpr.endsWith("()") ) { - final String lenFieldName = CodeGenUtils.decapitalizeString( elemCountExpr.substring(3, elemCountExpr.length()-2) ); - final Field lenField = structCType.getField(lenFieldName); - if( null != lenField ) { - _constElemCount = lenField.getType().isConst(); + final String baseLenFieldName = elemCountExpr.substring(3, elemCountExpr.length()-2); + String lenFieldName = CodeGenUtils.decapitalizeString( baseLenFieldName ); + Field lenField = structCType.getField(lenFieldName); + if( null == lenField ) { + lenFieldName = baseLenFieldName; + lenField = structCType.getField(lenFieldName); } + if( null == lenField ) { + throw new GlueGenException("Unable to creating array accessors for field \"" + + fqStructFieldName + "\", because elemCountExpr specify following getter \"" + + elemCountExpr + "\" and host structure doesn't contain following field \"" + + CodeGenUtils.decapitalizeString( baseLenFieldName ) + "\" or \"" + + baseLenFieldName + "\"", + fieldType.getASTLocusTag()); + } + _constElemCount = lenField.getType().isConst(); LOG.log(INFO, structCType.getASTLocusTag(), unit.className+": elemCountExpr "+elemCountExpr+", lenFieldName "+lenFieldName+" -> "+lenField.toString()+", isConst "+_constElemCount); } |