Skip to content

v3.8.0 Produces Java Code that does not compile #6286

Closed

Description

@pluttrell

What version of protobuf and what language are you using?
Version: v3.8.0
Language: Java

What operating system (Linux, Windows, ...) and version?
macOS 10.14.5

What runtime / compiler are you using (e.g., python version or gcc version)
I'm using the compiler published as an artifact in a Maven repo.

What did you do?
v3.7.1 works fine. When I update to v3.8.0, I see the following issue.

Using the following gradle script snippet:

protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.8.0'
    }
    //noinspection GroovyAssignabilityCheck
    plugins {
        grpc {
            artifact = "io.grpc:protoc-gen-grpc-java:1.21.0"
        }
    }
    generateProtoTasks {
        ofSourceSet("main")*.plugins {
            grpc {}
        }
    }
    generatedFilesBaseDir = "$projectDir/src-generated"
}

Run the generateProto task.

What did you expect to see
The generated code should compile.

What did you see instead?
The generated classes that the plugin and protoc generate do not compile. The UnusedPrivateParameter class (without a package) is missing. Here's an snippet from some of the generated source:

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(
      UnusedPrivateParameter unused) {
    return new MyType();
  }

Compile Error:

error: cannot find symbol
      UnusedPrivateParameter unused) {
      ^
  symbol:   class UnusedPrivateParameter
  location: class MyType

Activity

  1. changed the title [-]3.8.0 Produces Java Code that does not compile[/-] [+]v3.8.0 Produces Java Code that does not compile[/+] on Jun 20, 2019
  2. prashant4nov commented on Jun 27, 2019

    @prashant4nov

    @pluttrell were you able to fix the issue? I am also having same issue.

  3. hilbertglm commented on Jun 27, 2019

    @hilbertglm

    I had the same problem, and adding the dependency as suggested resolved the issue for me.

  4. prashant4nov commented on Jun 27, 2019

    @prashant4nov

    @hilbertglm thanks for the reply. It worked now for me too.

  5. ghost closed this as completedon Jun 27, 2019
  6. pluttrell commented on Jun 29, 2019

    @pluttrell
    Author

    Yes, that did resolve my issue. Sorry for the delay.

  7. deepakchandh commented on Oct 29, 2019

    @deepakchandh

    Thanks

    Can you upgrade your protobuf runtime library too? https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java/3.8.0

    Thanks it did resolve the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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