Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protected List<T > getFieldOrder() generated code cause compilation issues in Java 1.8 #120

Open
bakkiaraj opened this issue Aug 5, 2019 · 1 comment

Comments

@bakkiaraj
Copy link

bakkiaraj commented Aug 5, 2019

I am using JNAerator for libclang JNA interface creation. Here is the command used,
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 "List" changes to "List", I had done the changes manually.

Ex:
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 ASTNode C type : const void*

* @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.

@jmnpedrosa
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants