I'm trying to create preset for faiss, which has a class named "Index".
The generated java code contains the following snippet
//...
@Name("std::vector<float>") public static class FloatVector extends Pointer {
//...
@Index public native float get(@Cast("size_t") long i);
public native FloatVector put(@Cast("size_t") long i, float value);
//...
}
//...
@Namespace("faiss") @NoOffset public static class Index extends Pointer {
static { Loader.load(); }
//...
}
//...
then the compiler complains
[ERROR] /home/motao/javacpp-presets/faiss/src/main/java/org/bytedeco/javacpp/faiss.java:[26,6] incompatible types: org.bytedeco.javacpp.faiss.Index cannot be converted to java.lang.annotation.Annotation
as org.bytedeco.javacpp.annotation.Index is shaded.
How should I fix it?
Something like I've done for Chilitags can work around that:
infoMap.put(new Info().javaText("import org.bytedeco.javacpp.annotation.Index;"))
I still get the same error after adding that Info.
The case is not that same, as there is no class named Index in https://github.com/bytedeco/javacpp-presets/blob/master/chilitags/src/main/java/org/bytedeco/javacpp/chilitags.java
There is one from OpenCV...
You could give the wrapping Java class a different name, if that's acceptable. That's usually what we should do anyway.
A different name is reasonable. I tried new Info("faiss::Index").javaNames("FaissIndex") but it made no differences. How could I change the name of the wrapping Java class?
The c++ class definition is here.
That's for methods and fields. For Pointer types, it's pointerTypes(...).
Got it. Finally I see "BUILD SUCCESS".
Thanks very much for your help!
@mythly @saudet where is that FAISS preset? I would like to have a look ;)
Got it. Finally I see "BUILD SUCCESS".
Thanks very much for your help!
where is that FAISS preset? I would like to have a look ;) @mythly
It's not available yet, see issue #827. Please consider making a contribution! Thanks
@tovbinm @ericxsun
Sorry, the preset is just a prove of concept and not finished.
Actually we decide to use handcraft C wrapper + JNI instead of javacpp in our project.
The reasons:
1) we need only some specific interfaces of faiss and don't want to spend time wrapping the whole library
2) we have some low level code which is much easier to be implemented in C rather than Java
Most helpful comment
Got it. Finally I see "BUILD SUCCESS".
Thanks very much for your help!