alibaba / fastFFI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Codegen failure

zhanglei1949 opened this issue · comments

When I try to Generating the a template FFIPointer classArrowFragment, the ffi throws error
<<
[ERROR] /Users/xiaolei.zl/lei/work/aone/gs/analytical_engine/java/grape-runtime/target/generated-sources/annotations/com/alibaba/graphscope/fragment/ArrowFragmentGen.java:[28,17] java.lang.IllegalStateException: A TypeDef has accepted two generation requests: TypeDef{typeElementName='com.alibaba.graphscope.fragment.ArrowFragment', declaredTypeElementName='com.alibaba.graphscope.fragment.ArrowFragment', template=@com.alibaba.fastffi.CXXTemplate(include={}, java={"Long"}, cxxFull="", cxx={"int64_t"}), cxxFullTypeName='gs::ArrowFragmentDefault<int64_t>', packageName='com.alibaba.graphscope.fragment', simpleClassName='ArrowFragment_cxx_0x999c91c4', fullClassName='com.alibaba.graphscope.fragment.ArrowFragment_cxx_0x999c91c4', ffiGen=@com.alibaba.fastffi.FFIGen(functionTemplates={@com.alibaba.fastffi.FFIFunGen(templates={@com.alibaba.fastffi.CXXTemplate(include={}, java={"Long"}, cxxFull="", cxx={"int64_t"}), @com.alibaba.fastffi.CXXTemplate(include={}, java={"Double"}, cxxFull="", cxx={"double"}), @com.alibaba.fastffi.CXXTemplate(include={}, java={"Integer"}, cxxFull="", cxx={"int32_t"})}, name="edgeDataColumn", parameterTypes={"DATA_T"}, returnType="com.alibaba.graphscope.ds.EdgeDataColumn<DATA_T>")}, templates={@com.alibaba.fastffi.CXXTemplate(include={}, java={"Long"}, cxxFull="", cxx={"int64_t"})}, type="com.alibaba.graphscope.fragment.ArrowFragment", library=""), ffiFunGens=[@com.alibaba.fastffi.FFIFunGen(templates={@com.alibaba.fastffi.CXXTemplate(include={}, java={"Long"}, cxxFull="", cxx={"int64_t"}), @com.alibaba.fastffi.CXXTemplate(include={}, java={"Double"}, cxxFull="", cxx={"double"}), @com.alibaba.fastffi.CXXTemplate(include={}, java={"Integer"}, cxxFull="", cxx={"int32_t"})}, name="edgeDataColumn", parameterTypes={"DATA_T"}, returnType="com.alibaba.graphscope.ds.EdgeDataColumn<DATA_T>")], ffiTypeAlias=@com.alibaba.fastffi.FFITypeAlias(value="gs::ArrowFragmentDefault"), ffiNamespace=null, ffiMirror=null, ffiLibrary=null} vs. TypeDef{typeElementName='com.alibaba.graphscope.fragment.ArrowFragment', declaredTypeElementName='com.alibaba.graphscope.fragment.ArrowFragment', template=com.alibaba.fastffi.annotation.TypeEnv$1@10, cxxFullTypeName='gs::ArrowFragmentDefault<int64_t>', packageName='com.alibaba.graphscope.fragment', simpleClassName='ArrowFragment_cxx_0x999c91c4', fullClassName='com.alibaba.graphscope.fragment.ArrowFragment_cxx_0x999c91c4', ffiGen=@com.alibaba.fastffi.FFIGen(functionTemplates={}, templates={}, type="", library="grape-jni"), ffiFunGens=[], ffiTypeAlias=@com.alibaba.fastffi.FFITypeAlias(value="gs::ArrowFragmentDefault"), ffiNamespace=null, ffiMirror=null, ffiLibrary=null}

The arrowFragment is defined as

public interface ArrowFragment<OID_T> extends FFIPointer {
}
  • When do I meet this problem?
    After jump from commit a166c6287f2efb938c27fb01b3d499932d484f9c to release0.1

According to my test, just uncomment https://github.com/alibaba/fastFFI/blob/main/annotation-processor/src/main/java/com/alibaba/fastffi/annotation/TypeDefRegistry.java#L177 works fine for me...

How could I reproduce the issue?

Thanks!

By removing @FFIGen annotation of the class definition, the issue is somehow fixed...
The underly reason need to be look into in the future.