Generated Java code from .proto file with FileDescriptorProto field produces deprecation warning
What version of protobuf and what language are you using? Version: 3.11.4 Language: Java
What operating system (Linux, Windows, ...) and version? Linux (Ubuntu 16.04)
What runtime / compiler are you using (e.g., python version or gcc version) AdoptOpenJDK Java 11.0.7+10
What did you do? Steps to reproduce the behavior:
- Use protoc to compile the following example.proto. Note that the message contains a FileDescriptorProto field.
syntax = "proto3";
package example;
option java_package = "com.example";
option java_outer_classname = "ExampleProtos";
import "google/protobuf/descriptor.proto";
message Example {
google.protobuf.FileDescriptorProto file_proto = 1;
}
- Compile the resultant Java code.
What did you expect to see No warnings.
What did you see instead? The following deprecation warning is shown:
/home/yeefan/protoc/java/src/main/java/com/example/ExampleProtos.java:86: warning: [deprecation] PARSER in FileDescriptorProto has been deprecated
fileProto_ = input.readMessage(com.google.protobuf.DescriptorProtos.FileDescriptorProto.PARSER, extensionRegistry);
Anything else we should know about your project / environment Issue #7271 implies that deprecated code is accessed in generated Java code from any .proto file. However, I encounter this issue only when my message contains a FileDescriptorProto field. My .proto files without FileDescriptorProto fields compile with no warnings, as expected.
dupe of #7271