Thrift include two files with same name?

夙愿已清 提交于 2019-12-23 12:42:53

问题


I have this structure: (namespace is java)

package/common.thrift
common.thrift
fileA.thrift

I want fileA.thrift to include both common.thrift

include ".../package/common.thrift"
include "common.thrift"

struct A {
   1: common.Something something #From first file (no error)
   2: common.SomethingElse else  #This throws error.
}

Thrift only reads content from the file specified first in order. Is there a way for this : common.thrift as common So that i can differentiate them. Or the only solution is to have different file names


回答1:


Thrift only reads content from the file specified first in order

Not quite. But Thrift needs a prefix to access things that are included. Because the prefix is the file name, you cannot have two "common" files included without producing ambiguities.

Consequently, the answer to the question is no, you can't.



来源:https://stackoverflow.com/questions/32563197/thrift-include-two-files-with-same-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!