GithubHelp home page GithubHelp logo

Comments (17)

xiemalin avatar xiemalin commented on July 20, 2024

这个的确有问题,临时解决方案,把
enum DataVisibility {
PUBLIC = 1;
PRIVATE = 2;
}定义成全局
修改DataStatus定义如下
message DataStatus {
optional DataVisibility visibility = 1;
}

from jprotobuf.

abop avatar abop commented on July 20, 2024

首先感谢下这个项目,希望能尽快解决这个feature。
最近项目比较紧,先work around了,两周后估计有时间我也会看看能不能提个pr,你这边进度也在评论里同步一下吧。
再次感谢!

from jprotobuf.

xiemalin avatar xiemalin commented on July 20, 2024

修复版本已发布, 版本号为 1.9.5

from jprotobuf.

abop avatar abop commented on July 20, 2024

感谢🙏
matthew xie [email protected]于2016年2月25日 周四20:50写道:

修复版本已发布, 版本号为 1.9.5


Reply to this email directly or view it on GitHub
#40 (comment).

from jprotobuf.

abop avatar abop commented on July 20, 2024

jprotobuf版本:1.9.5/1.9.6

如果proto文件有package声明,仍会触发之前的异常

src/test/java/com/baidu/bjf/remoting/protobuf/idlproxy/ProtobufIDLProxyTest.java

        StringBuilder idl = new StringBuilder();
        // 这里增加package声明
        idl.append("package mypkg;\n");
        idl.append("message DataInfo {\n");
        idl.append("   enum DataVisibility {\n");

        idl.append("   PUBLIC = 1;\n");
        idl.append("   PRIVATE = 2;\n");
        idl.append("   }");
        idl.append("    optional DataVisibility v = 1;\n");
        idl.append("   message SubDataInfo {\n");
        idl.append("      optional string name =1;\n");
        idl.append("      message Sub2DataInfo {\n");
        idl.append("        required int32 age = 1;\n");
        idl.append("      }\n");
        idl.append("   }\n");

        idl.append("}\n");


        idl.append("message DataStatus {\n");
        idl.append("   optional DataInfo.DataVisibility visibility = 1; \n");
        idl.append("   optional DataInfo.SubDataInfo subDataInfo = 2;\n");
        idl.append("   optional DataInfo.SubDataInfo.Sub2DataInfo sub2DataInfo = 3;\n");
        idl.append("}");

        System.out.println(idl.toString());
        ProtobufIDLProxy.generateSource(idl.toString(), new File("/"));

from jprotobuf.

abop avatar abop commented on July 20, 2024

需要提新的issue么?

from jprotobuf.

xiemalin avatar xiemalin commented on July 20, 2024

我重新打开这个issue吧

from jprotobuf.

xiemalin avatar xiemalin commented on July 20, 2024

1.9.7-SNAPSHOT 先使用这个版本进行测试,目前还需要更多场景进行验证

from jprotobuf.

abop avatar abop commented on July 20, 2024

1.9.7-SNAPSHOT 没上传maven仓库么?

from jprotobuf.

xiemalin avatar xiemalin commented on July 20, 2024

前天就已上传了

from jprotobuf.

abop avatar abop commented on July 20, 2024

http://repo1.maven.org/maven2/com/baidu/jprotobuf/ 真没有

from jprotobuf.

xiemalin avatar xiemalin commented on July 20, 2024

https://oss.sonatype.org/content/repositories/snapshots/com/baidu/jprotobuf/1.9.7-SNAPSHOT/

from jprotobuf.

abop avatar abop commented on July 20, 2024

不好意思 应该是我们公司镜像同步的问题,我先下载下来测试

from jprotobuf.

abop avatar abop commented on July 20, 2024

1.9.7-SNAPSHOT版本 import语句会导致抛错。

用例:
file1: Pk1.proto

package mypkg1;
message MyMsg {
    optional string msg = 1;
}

file2: Pk2.Proto

package mypkg2;
import Pk1.proto;
message MyMsg2 {
    optional mypkg1.MyMsg msg = 1;
}

运行:

try {
    ProtobufIDLProxy.generateSource(new File("Pk2.proto"), new File("gen/"));
} catch (IOException e) {
    e.printStackTrace();
}

抛异常:

Exception in thread "main" java.lang.RuntimeException: Message 'MyMsg2' depend on message 'mypkg1.MyMsg' is missed
    at com.baidu.bjf.remoting.protobuf.ProtobufIDLProxy.hasDependency(ProtobufIDLProxy.java:529)
    at com.baidu.bjf.remoting.protobuf.ProtobufIDLProxy.createClass(ProtobufIDLProxy.java:433)
...

from jprotobuf.

xiemalin avatar xiemalin commented on July 20, 2024

这个场景的确没有测试过,需要解决

from jprotobuf.

xiemalin avatar xiemalin commented on July 20, 2024

1.9.7-SNAPSHOT 已更新,修正 import方式下的引入问题

from jprotobuf.

xiemalin avatar xiemalin commented on July 20, 2024

基本的测试已经通过, 1.9.7版本已发布

from jprotobuf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.