ProtoC输出什么Java版本? - 原始生成的Java输出不会编译

发布于 2025-02-10 10:58:02 字数 958 浏览 1 评论 0原文

我正在尝试使用Google定义为.proto文件的GTF https:// https://developers.google.com/static/transit/ gtfs-realtime/gtfs-realtime.proto

我下载此文件并使用Protoc(libprotoc 3.17.3)进行编译,该文件创建gftsrealtime.java文件。但是,当我尝试编译此内容时,我会遇到以下错误:

GtfsRealtime.java:2537: error: cannot find symbol
        UnusedPrivateParameter unused) {
        ^
...
GtfsRealtime.java:20170: error: method does not override or implement a method from a supertype
    @java.lang.Override
    ^

这是我(MacOS)机器上的Java -version

> java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

我觉得问题是Protoc正在生成Java源代码的不同版本与我正在运行的不同,但我无法弄清protoc生成的Java版本?

I am trying to use the GTFS defined as a .proto file by Google here
https://developers.google.com/static/transit/gtfs-realtime/gtfs-realtime.proto

I download this file and compile it using protoc (libprotoc 3.17.3) which creates a GftsRealtime.java file. But when I try to compile this, I'm getting errors such as the following:

GtfsRealtime.java:2537: error: cannot find symbol
        UnusedPrivateParameter unused) {
        ^
...
GtfsRealtime.java:20170: error: method does not override or implement a method from a supertype
    @java.lang.Override
    ^

Here is the java --version on my (MacOS) machine:

> java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

I feel like the the issue is that protoc is generating a different version of Java source code than I am running but I can't figure out what Java version is generated by protoc?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文