Open bakkiaraj opened 4 years ago
I'm having the same issue.
To clarify, any generated classes that extend Structure
are overriding the method getFieldOrder
incorrectly (with a return type of List<T >
), causing compilation errors.
For example:
protected List<T > getFieldOrder() {
return Arrays.asList("fSpatialType", "fSpatialValidityUnion");
}
It should be:
protected List<String> getFieldOrder() {
return Arrays.asList("fSpatialType", "fSpatialValidityUnion");
}
I tested this in Java 8 with JNA 4.5.8 and the maven-jnaerator-plugin version 0.12.
I am using JNAerator for libclang JNA interface creation. Here is the command used," changes to "List", I had done the changes manually.
java -Xmx1300m -jar jnaerator-0.12-shaded.jar -arch win32 libx86/libclang.dll -library libclang -libFile libx86/libclang.dll -I./inc/ ./inc/clang-c/Index.h ./inc/clang-c/Platform.h ./inc/clang-c/CXErrorCode.h ./inc/clang-c/CXString.h ./inc/clang-c/CXCompilationDatabase.h ./inc/clang-c/Documentation.h ./inc/clang-c/BuildSystem.h -mode Directory -f -runtime JNA -o ./generated -rootPackage com.np -skipDeprecated -preferJavac -v
The generated code has multiple compilation issues , All of them were are "ListEx: public class CXComment extends Structure { / C type : const void / public Pointer ASTNode; / C type : CXTranslationUnit */ public CXTranslationUnit TranslationUnit; public CXComment() { super(); } protected List getFieldOrder() {
return Arrays.asList("ASTNode", "TranslationUnit");
}
/**
@param TranslationUnit C type : CXTranslationUnit */ public CXComment(Pointer ASTNode, CXTranslationUnit TranslationUnit) { super(); this.ASTNode = ASTNode; this.TranslationUnit = TranslationUnit; } public CXComment(Pointer peer) { super(peer); } public static class ByReference extends CXComment implements Structure.ByReference {
}; public static class ByValue extends CXComment implements Structure.ByValue {
}; }
Please update the code in a way that List is used in the generated code.