Comments (17)
这个的确有问题,临时解决方案,把
enum DataVisibility {
PUBLIC = 1;
PRIVATE = 2;
}定义成全局
修改DataStatus定义如下
message DataStatus {
optional DataVisibility visibility = 1;
}
from jprotobuf.
首先感谢下这个项目,希望能尽快解决这个feature。
最近项目比较紧,先work around了,两周后估计有时间我也会看看能不能提个pr,你这边进度也在评论里同步一下吧。
再次感谢!
from jprotobuf.
修复版本已发布, 版本号为 1.9.5
from jprotobuf.
感谢🙏
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.
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.
需要提新的issue么?
from jprotobuf.
我重新打开这个issue吧
from jprotobuf.
1.9.7-SNAPSHOT 先使用这个版本进行测试,目前还需要更多场景进行验证
from jprotobuf.
1.9.7-SNAPSHOT 没上传maven仓库么?
from jprotobuf.
前天就已上传了
from jprotobuf.
http://repo1.maven.org/maven2/com/baidu/jprotobuf/ 真没有
from jprotobuf.
https://oss.sonatype.org/content/repositories/snapshots/com/baidu/jprotobuf/1.9.7-SNAPSHOT/
from jprotobuf.
不好意思 应该是我们公司镜像同步的问题,我先下载下来测试
from jprotobuf.
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.
这个场景的确没有测试过,需要解决
from jprotobuf.
1.9.7-SNAPSHOT 已更新,修正 import方式下的引入问题
from jprotobuf.
基本的测试已经通过, 1.9.7版本已发布
from jprotobuf.
Related Issues (20)
- protobuf-java3.9.0有问题, 需要升级一下.
- 如何自定义 生成proto文件的package 名称?
- protobuf-java 可否打成 shade 包? HOT 2
- ProtobufProxy.create 在高并发的情况下会Block线程 HOT 3
- 父类与子类字段序列化顺序错误 HOT 2
- protobuf-java3.9.2有漏洞提示 HOT 1
- jprotobuf嵌套对象,多文件导出,嵌套对象定义重复 HOT 3
- pojo中类型为short的无法进行创建proto代理 HOT 3
- java.lang.IllegalArgumentException: 无效的源发行版: 1.8
- 这里public的静态变量和set方法冲突
- 预编译插件发生错误 HOT 2
- java21中无法使用预编译,且打成jar包后无法运行 HOT 7
- 预编译插件在复杂对象中可能编译出错 HOT 7
- List<Date>类型字段预编译报错 HOT 2
- 预编译插件,一个实体被多个实体依赖时预编译中断 HOT 5
- java转.proto pojo的注释不会带到生成的.proto中
- 序列化在开发环境可以正常使用,但打成 jar 包运行后,序列化时会报错 HOT 6
- java21,springBoot3.2 打 jar 后使用异常
- 配置outputDirectory参数不生效,没有移动编译后的代码到outputDirectory中
- 预编译报错,JDK版本1.8 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jprotobuf.