Skip to content

Generated OuterClass has a lot of incompatibilities ! #2300

@smallufo

Description

@smallufo

Hi , I am new to gRPC / protobuf , and facing a first step problem...

This is my first .proto file :

syntax = "proto3";
option java_package = "destiny.identity.services.grpc";

service EchoService {
    rpc echo (EchoRequest) returns (EchoReply) {}
}

message EchoRequest {
    string name=1;
}

message EchoReply {
    string message = 1;
}

It is simple , but the generated EchoServiceOuterClass.java has a lot of incompatibilities :

~/destiny-identity/target/generated-sources/protobuf/java/destiny/identity/services/grpc/EchoServiceOuterClass.java
Error:(83, 13) java: incompatible types: java.io.IOException cannot be converted to java.lang.String
Error:(152, 18) java: memoizedSize has private access in com.google.protobuf.AbstractMessage
Error:(159, 7) java: memoizedSize has private access in com.google.protobuf.AbstractMessage
Error:(394, 18) java: cannot find symbol
  symbol:   method unwrapIOException()
  location: variable e of type com.google.protobuf.InvalidProtocolBufferException
Error:(586, 13) java: incompatible types: java.io.IOException cannot be converted to java.lang.String
Error:(655, 18) java: memoizedSize has private access in com.google.protobuf.AbstractMessage
Error:(662, 7) java: memoizedSize has private access in com.google.protobuf.AbstractMessage
Error:(897, 18) java: cannot find symbol
  symbol:   method unwrapIOException()
  location: variable e of type com.google.protobuf.InvalidProtocolBufferException

For example :

Image

This is my [ partial ] pom.xml

<dependencies>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-netty</artifactId>
      <version>${grpc.version}</version>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-protobuf</artifactId>
      <version>${grpc.version}</version>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-stub</artifactId>
      <version>${grpc.version}</version>
    </dependency>
   ... other skipped ...
</dependencies>

// the related plugin :
<plugin>
  <groupId>org.xolstice.maven.plugins</groupId>
  <artifactId>protobuf-maven-plugin</artifactId>
  <version>0.5.0</version>
  <configuration>
    <!--
      The version of protoc must match protobuf-java. If you don't depend on
      protobuf-java directly, you will be transitively depending on the
      protobuf-java version that grpc depends on.
    -->
    <protocArtifact>com.google.protobuf:protoc:3.0.0:exe:${os.detected.classifier}</protocArtifact>
    <pluginId>grpc-java</pluginId>
    <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.0.0:exe:${os.detected.classifier}</pluginArtifact>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
        <goal>compile-custom</goal>
      </goals>
    </execution>
  </executions>
</plugin>

The grpc-netty , grpc-protobuf , grpc-stub are all of version of 1.0.0

Where goes wrong here ?

Thanks.

I am new to gRPC / protobuf , sorry I don't know whether the problem is related to grpc-java project or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions