protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

v3.19.1 Produces Java Code that does not compile

Open ridvantanik opened this issue 4 years ago • 25 comments

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

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

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.

<properties>
    <protobuf.version>3.19.1</protobuf.version>
    <protoc-jar-maven-plugin.version>3.11.4</protoc-jar-maven-plugin.version>
</properties>
<dependency>
  <groupId>com.google.protobuf</groupId>
  <artifactId>protobuf-java</artifactId>
  <version>${protobuf.version}</version>
</dependency>
<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-java-util</artifactId>
    <version>${protobuf.version}</version>
</dependency>

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 QuoteScore();
}
public enum MessageCase
        implements com.google.protobuf.Internal.EnumLite,
        com.google.protobuf.AbstractMessage.InternalOneOfEnum {...}

Compile Error:

error: cannot find symbol
[ERROR]   symbol:   class InternalOneOfEnum
[ERROR]   location: class AbstractMessage
error: cannot find symbol
[ERROR]   symbol:   class UnusedPrivateParameter
[ERROR]   location: class FileNeedsVendor

ridvantanik avatar Dec 23 '21 15:12 ridvantanik

I'm experiencing the same issue as well. It's crazy to think this still exists considering Apple Silicon is around for a while now.

kaandemirel avatar Dec 23 '21 16:12 kaandemirel

I have searched everywhere but could not find the solution. How it can be possible at the end of 2021?

fethan avatar Dec 23 '21 16:12 fethan

Can you provide a reproducer URL? This is odd.

perezd avatar Dec 23 '21 17:12 perezd

are you using protoc from 3.19.1 as well? It looks like you're using the right runtime but wondering if the generators are outdated?

EDIT: Shouldn't these numbers match?

    <protobuf.version>3.19.1</protobuf.version>
    <protoc-jar-maven-plugin.version>3.11.4</protoc-jar-maven-plugin.version>

perezd avatar Dec 23 '21 17:12 perezd

I'm experiencing the same issue as well. It's crazy to think this still exists considering Apple Silicon is around for a while now.

It's not clear to me how this has anything to do with Apple Silicon? Can you explain this connection for me?

perezd avatar Dec 23 '21 17:12 perezd

Asked the team internally, and it looks like you're using this: https://github.com/os72/protoc-jar-maven-plugin

We don't maintain this, and is likely not up to date w/ the runtime you're pulling in. Please file an issue there or a PR to update the version of protoc it is using.

Looks like they maintain protoc themselves for some reason here: https://github.com/os72/protoc-jar/tree/master/bin

perezd avatar Dec 23 '21 17:12 perezd

@perezd Thank you for the quick response. I am using a maven plugin which can be configured to use a specific protoc version. The latest version for the plugin is 3.11.4. Here is the configuration in the pom :

<plugin>
    <groupId>com.github.os72</groupId>
    <artifactId>protoc-jar-maven-plugin</artifactId>
    <version>${protoc-jar-maven-plugin.version}</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <protocVersion>${protobuf.version}</protocVersion>
                <includeStdTypes>true</includeStdTypes>
            </configuration>
        </execution>
    </executions>
</plugin>

Here is a part of the maven execution log :

[INFO] --- protoc-jar-maven-plugin:3.11.4:run (default) @ common ---
[INFO] Protoc version: 3.19.1
protoc-jar: protoc version: 3.19.1, detected platform: osx-aarch_64 (mac os x/aarch64)
protoc-jar: using default maven settings, didn't find user settings.xml
protoc-jar: cached: /var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar.webcache/com/google/protobuf/protoc/maven-metadata.xml
protoc-jar: cached: /var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar.webcache/com/google/protobuf/protoc/3.19.1/protoc-3.19.1-osx-aarch_64.exe
protoc-jar: executing: [/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar7876237223281454485/bin/protoc.exe, --version]
libprotoc 3.19.1
[INFO] Protoc command: /var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar7876237223281454485/bin/protoc.exe
[INFO] Additional include types: /var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15648596583107759925/include
[INFO] Input directories:
[INFO]     /path/to/project/common/src/main/protobuf
[INFO] Include directories:
[INFO]     /var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15648596583107759925/include
[INFO] Output targets:
[INFO]     java: /path/to/project/common/target/generated-sources (add: main, clean: false, plugin: null, outputOptions: null)
[INFO] /path/to/project/common/target/generated-sources does not exist. Creating...
[INFO]     Processing (java): Events.proto
protoc-jar: executing: [/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar7876237223281454485/bin/protoc.exe, -I/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15648596583107759925/include, -I/path/to/project/common/src/main/protobuf, --java_out=/path/to/project/common/target/generated-sources, /path/to/project/common/src/main/protobuf/Events.proto]

ridvantanik avatar Dec 23 '21 17:12 ridvantanik

It looks like you'll need to do one of two things:

  1. petition the author of the plugin to upgrade protoc to 3.19.x
  2. downgrade the protobuf-java runtime you use to match something compatible with the generator/protoc version that is getting invoked. They aren't allowed to drift significantly, we make zero guarantees about compatibility of compiler + runtime versions being mismatched.

perezd avatar Dec 23 '21 17:12 perezd

Am I missing something? The protoc's and the runtime's versions are same. What I see is they are both 3.19.1 according to the log I provided above.

ridvantanik avatar Dec 23 '21 17:12 ridvantanik

Am I missing something? The protoc's and the runtime's versions are same. What I see is they are both 3.19.1 according to the log I provided above.

Interesting, is the protoc jar from the maven plugin not based on this? https://github.com/os72/protoc-jar/tree/master/bin/3.11.4

that's what maven says based on the pom you provided.

Are you able to try doing this outside of maven with a regular protoc binary? I'd like to isolate this a bit better.

EDIT: I wonder if that log line is trustworthy/actually coming from protoc that is being invoked, or naively just a string concat based on a property in the pom file..

perezd avatar Dec 23 '21 17:12 perezd

Am I missing something? The protoc's and the runtime's versions are same. What I see is they are both 3.19.1 according to the log I provided above.

Interesting, is the protoc jar from the maven plugin not based on this? https://github.com/os72/protoc-jar/tree/master/bin/3.11.4

that's what maven says based on the pom you provided.

Are you able to try doing this outside of maven with a regular protoc binary? I'd like to isolate this a bit better.

No, it is not base on that version. The protoc version can be configurable regardless of the version of the plugin in the pom like below (which I did and the log shows it is configured correctly)

<configuration>
    <protocVersion>3.19.1</protocVersion>
</configuration>

However you are right, to better isolate the problem I will run the protoc outside of the maven build (basicly from terminal)

ridvantanik avatar Dec 23 '21 18:12 ridvantanik

you can set that, but I don't see that option in the jar they are using that contains the actual executable, that's my wonder...I don't know this codebase well and wonder if it's a validation failure, for example, here's a bug that says this tool doesn't support protoc 3.15.x: https://github.com/os72/protoc-jar-maven-plugin/issues/107

This makes me think it's not actually running 3.19.1 as you wanted.

EDIT: Looking at your original pom, I never saw this configurationblock, and reminder, this isn't a tool we support so I'm guessing here.

EDIT2: Guessing this will attempt to pull our published protoc from maven if you specify one they don't have? In that case I don't understand what else could be going wrong, confirming this reproducible outside of maven is now the priority I think.

perezd avatar Dec 23 '21 18:12 perezd

Unfortunately, running protoc outside of the maven produced the same result. You can see the protoc version that I am using at the end of the terminal log.

ridvantanik@RIDVANs-MacBook-Pro target % protoc -I=/path/to/the/project/common/src/main/protobuf --java_out=/path/to/the/project/common/target/generated-sources /path/to/the/project/common/src/main/protobuf/Events.proto
ridvantanik@RIDVANs-MacBook-Pro target % protoc -I=/path/to/the/project/common/src/main/protobuf --java_out=/path/to/the/project/common/target/generated-sources /path/to/the/project/common/src/main/protobuf/Internal.proto
ridvantanik@RIDVANs-MacBook-Pro target % protoc -I=/path/to/the/project/common/src/main/protobuf --java_out=/path/to/the/project/common/target/generated-sources /path/to/the/project/common/src/main/protobuf/Database.proto
ridvantanik@RIDVANs-MacBook-Pro target % protoc -I=/path/to/the/project/common/src/main/protobuf --java_out=/path/to/the/project/common/target/generated-sources /path/to/the/project/common/src/main/protobuf/Answer.proto
ridvantanik@RIDVANs-MacBook-Pro target % protoc -I=/path/to/the/project/common/src/main/protobuf --java_out=/path/to/the/project/common/target/generated-sources /path/to/the/project/common/src/main/protobuf/Feedback.proto
ridvantanik@RIDVANs-MacBook-Pro target % protoc -I=/path/to/the/project/common/src/main/protobuf --java_out=/path/to/the/project/common/target/generated-sources /path/to/the/project/common/src/main/protobuf/Neo4j.proto
Neo4j.proto:6:1: warning: Import google/protobuf/any.proto is unused.
ridvantanik@RIDVANs-MacBook-Pro target % protoc -I=/path/to/the/project/common/src/main/protobuf --java_out=/path/to/the/project/common/target/generated-sources /path/to/the/project/common/src/main/protobuf/Mautic.proto
Mautic.proto:3:1: warning: Import google/protobuf/struct.proto is unused.
Mautic.proto:7:1: warning: Import google/protobuf/any.proto is unused.
ridvantanik@RIDVANs-MacBook-Pro target % protoc -I=/path/to/the/project/common/src/main/protobuf --java_out=/path/to/the/project/common/target/generated-sources /path/to/the/project/common/src/main/protobuf/Question.proto
ridvantanik@RIDVANs-MacBook-Pro target % protoc --version
libprotoc 3.19.1

And the resulting java files still contains the non-compilable code segments :

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

and

public enum MessageCase
        implements com.google.protobuf.Internal.EnumLite,
            com.google.protobuf.AbstractMessage.InternalOneOfEnum {...}

There was no problem before while we were using 3.7.1 but I had to upgrade the protobuf version to >3.18.0 because of the fact that my local machine is based on apple silicon and the protobuf binary support for apple silicon comes with 3.18.0

ridvantanik avatar Dec 23 '21 18:12 ridvantanik

Can you provide the full compilation stack traces for these errors? I can't really tell what's going wrong.

EDIT: I don't believe Apple Silicon has anything to do with compiling java btw, it's a virtual machine.

perezd avatar Dec 23 '21 18:12 perezd

Also, I believe UnusedPrivateParameter doesn't need to be fully qualified because its statically nested within GeneratedMessageV3 which your generated code should be subclassing, and is within the same package of GeneratedMessageV3so it should resolve just fine.

Further, that line hasn't changed for 3 years, so it's not a regression introduced in 3.19: https://github.com/protocolbuffers/protobuf/blob/f367bfb13d9ff5f097666bcdf7389aa8cef902b7/src/google/protobuf/compiler/java/java_message.cc#L374

perezd avatar Dec 23 '21 19:12 perezd

Can you provide the full compilation stack traces for these errors? I can't really tell what's going wrong.

EDIT: I don't believe Apple Silicon has anything to do with compiling java btw, it's a virtual machine.

The root cause of the problem is not compiling .java files into .class files, the problem merely manifests itself at there. However the root cause resides in generating java files from .proto files. Here is the log you requested

[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ common ---
[INFO] Deleting /path/to/the/project/common/target
[INFO] 
[INFO] --- protoc-jar-maven-plugin:3.11.4:run (default) @ common ---
[INFO] Protoc version: 3.19.1
protoc-jar: protoc version: 3.19.1, detected platform: osx-aarch_64 (mac os x/aarch64)
protoc-jar: using default maven settings, didn't find user settings.xml
protoc-jar: cached: /var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar.webcache/com/google/protobuf/protoc/maven-metadata.xml
protoc-jar: cached: /var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar.webcache/com/google/protobuf/protoc/3.19.1/protoc-3.19.1-osx-aarch_64.exe
protoc-jar: executing: [/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar10372122106880917086/bin/protoc.exe, --version]
libprotoc 3.19.1
[INFO] Protoc command: /var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar10372122106880917086/bin/protoc.exe
[INFO] Additional include types: /var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15678499803004577311/include
[INFO] Input directories:
[INFO]     /path/to/the/project/common/src/main/protobuf
[INFO] Include directories:
[INFO]     /var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15678499803004577311/include
[INFO] Output targets:
[INFO]     java: /path/to/the/project/common/target/generated-sources (add: main, clean: false, plugin: null, outputOptions: null)
[INFO] /path/to/the/project/common/target/generated-sources does not exist. Creating...
[INFO]     Processing (java): Events.proto
protoc-jar: executing: [/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar10372122106880917086/bin/protoc.exe, -I/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15678499803004577311/include, -I/path/to/the/project/common/src/main/protobuf, --java_out=/path/to/the/project/common/target/generated-sources, /path/to/the/project/common/src/main/protobuf/Events.proto]
[INFO]     Processing (java): Internal.proto
protoc-jar: executing: [/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar10372122106880917086/bin/protoc.exe, -I/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15678499803004577311/include, -I/path/to/the/project/common/src/main/protobuf, --java_out=/path/to/the/project/common/target/generated-sources, /path/to/the/project/common/src/main/protobuf/Internal.proto]
[INFO]     Processing (java): Database.proto
protoc-jar: executing: [/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar10372122106880917086/bin/protoc.exe, -I/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15678499803004577311/include, -I/path/to/the/project/common/src/main/protobuf, --java_out=/path/to/the/project/common/target/generated-sources, /path/to/the/project/common/src/main/protobuf/Database.proto]
[INFO]     Processing (java): Answer.proto
protoc-jar: executing: [/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar10372122106880917086/bin/protoc.exe, -I/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15678499803004577311/include, -I/path/to/the/project/common/src/main/protobuf, --java_out=/path/to/the/project/common/target/generated-sources, /path/to/the/project/common/src/main/protobuf/Answer.proto]
[INFO]     Processing (java): Feedback.proto
protoc-jar: executing: [/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar10372122106880917086/bin/protoc.exe, -I/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15678499803004577311/include, -I/path/to/the/project/common/src/main/protobuf, --java_out=/path/to/the/project/common/target/generated-sources, /path/to/the/project/common/src/main/protobuf/Feedback.proto]
[INFO]     Processing (java): Neo4j.proto
protoc-jar: executing: [/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar10372122106880917086/bin/protoc.exe, -I/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15678499803004577311/include, -I/path/to/the/project/common/src/main/protobuf, --java_out=/path/to/the/project/common/target/generated-sources, /path/to/the/project/common/src/main/protobuf/Neo4j.proto]
Neo4j.proto:6:1: warning: Import google/protobuf/any.proto is unused.
[WARNING] /path/to/the/project/common/src/main/protobuf/Neo4j.proto [6:1]:  warning: Import google/protobuf/any.proto is unused.
[WARNING] /path/to/the/project/common/src/main/protobuf/Neo4j.proto [0:0]: 
[INFO]     Processing (java): Mautic.proto
protoc-jar: executing: [/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar10372122106880917086/bin/protoc.exe, -I/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15678499803004577311/include, -I/path/to/the/project/common/src/main/protobuf, --java_out=/path/to/the/project/common/target/generated-sources, /path/to/the/project/common/src/main/protobuf/Mautic.proto]
Mautic.proto:3:1: warning: Import google/protobuf/struct.proto is unused.
Mautic.proto:7:1: warning: Import google/protobuf/any.proto is unused.
[WARNING] /path/to/the/project/common/src/main/protobuf/Mautic.proto [3:1]:  warning: Import google/protobuf/struct.proto is unused.
[WARNING] /path/to/the/project/common/src/main/protobuf/Mautic.proto [7:1]:  warning: Import google/protobuf/any.proto is unused.
[WARNING] /path/to/the/project/common/src/main/protobuf/Mautic.proto [0:0]: 
[INFO]     Processing (java): Question.proto
protoc-jar: executing: [/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar10372122106880917086/bin/protoc.exe, -I/var/folders/5w/lb872y8x0kjgj8j8vwd699vh0000gn/T/protocjar15678499803004577311/include, -I/path/to/the/project/common/src/main/protobuf, --java_out=/path/to/the/project/common/target/generated-sources, /path/to/the/project/common/src/main/protobuf/Question.proto]
[INFO] Adding generated sources (java): /path/to/the/project/common/target/generated-sources
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ common ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /path/to/the/project/common/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ common ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 59 source files to /path/to/the/project/common/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Database.java:[58,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class QuoteScore
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Events.java:[112,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class WorkerEvent
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Events.java:[10023,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class InstantTranslationResult
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Events.java:[11936,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class TimelineTypeId
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Feedback.java:[4283,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Action
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Feedback.java:[3368,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Address
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Feedback.java:[7323,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Content
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Feedback.java:[787,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class FeedbackMessage
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Events.java:[12719,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Tokens
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Events.java:[2039,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Payload
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Mautic.java:[130,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class EmailMessage
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Neo4j.java:[1248,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class ListOfStrings
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Neo4j.java:[120,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class GenericCypherStatementWithParameters
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Neo4j.java:[1897,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class VendorDocumentTqs
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Neo4j.java:[6964,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class LanguagePair
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Neo4j.java:[7840,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Document
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Neo4j.java:[8798,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Subject
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Neo4j.java:[6168,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Corporate
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Neo4j.java:[5242,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Client
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Neo4j.java:[4512,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Project
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Neo4j.java:[2808,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Neo4jFeedData
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[944,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class InternalMessage
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[1119,47] error: cannot find symbol
  symbol:   class InternalOneOfEnum
  location: class AbstractMessage
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[17671,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class FileNeedsVendor
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[16062,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class ProjectStatusUpdate
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[15051,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class FileActivityMessage
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[14181,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class FileStatusUpdate
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[12833,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class SalesActivity
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[8448,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class ProjectActivity
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[7604,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class AttendanceActivity
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[6688,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class LoginActivity
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[3203,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class ComebackAction
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[4328,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class VendorComingBack
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[5503,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class VendorHasComeBack
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[9227,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class EmailQuoteTimeout
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[9753,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class Address
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[10647,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class CancelableTimeout
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[11751,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class SelfTimeout
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[12312,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class InstantTranslationOccurredTimeout
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[13661,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class TrackVendorNeedsTimeout
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[16831,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class FileMilestone
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[18909,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class VendorWithNeeds
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[19748,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class IgnoreInvitation
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[20237,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class ProjectActivated
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Internal.java:[20741,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class TestMessage
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Answer.java:[162,47] error: cannot find symbol
  symbol:   class InternalOneOfEnum
  location: class AbstractMessage
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Answer.java:[71,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class GenericAnswer
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Answer.java:[998,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class WasProofreaderDeassignedBeforeApproval
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Answer.java:[1558,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class IsProofreaderAssigned
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Feedback.java:[5630,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class FeedbackEvent
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Question.java:[162,47] error: cannot find symbol
  symbol:   class InternalOneOfEnum
  location: class AbstractMessage
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Question.java:[71,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class GenericQuestion
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Question.java:[1644,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class WasProofreaderDeassignedBeforeApproval
[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Question.java:[1005,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class IsProofreaderAssigned
[INFO] 54 errors 

ridvantanik avatar Dec 23 '21 19:12 ridvantanik

Can you share a gist of the smallest generated file you have here? This is really bizarre.

perezd avatar Dec 23 '21 19:12 perezd

Also, I believe UnusedPrivateParameter doesn't need to be fully qualified because its statically nested within GeneratedMessageV3 which your generated code should be subclassing, and is within the same package of GeneratedMessageV3so it should resolve just fine.

Further, that line hasn't changed for 3 years, so it's not a regression introduced in 3.19:

https://github.com/protocolbuffers/protobuf/blob/f367bfb13d9ff5f097666bcdf7389aa8cef902b7/src/google/protobuf/compiler/java/java_message.cc#L374

Here is the beginning of one of the generated files :

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: Database.proto

package com.company.protobuf;

public final class Database {
  private Database() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistryLite registry) {
  }

  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
    registerAllExtensions(
        (com.google.protobuf.ExtensionRegistryLite) registry);
  }


The class is not a subclass of GeneratedMessageV3. Here is the protofile

syntax = "proto3";
package com.company.protobuf;

option java_package = "com.company.protobuf";
option java_outer_classname = "Database";


message QuoteScore {
  int64 quoteId = 1;
  string score = 2;
}

ridvantanik avatar Dec 23 '21 19:12 ridvantanik

OK, I'm afraid without the full file it's hard to help you, let me explain:

You've shown me to Database class, which is the outer class (it wouldn't subclass GeneratedMessageV3), However, QuoteScore which is an actual message would. According to your logs, that would be the one affected:

[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Database.java:[58,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class QuoteScore

Without more context, I can't really help you debug this.

perezd avatar Dec 23 '21 19:12 perezd

OK, I'm afraid without the full file it's hard to help you, let me explain:

You've shown me to Database class, which is the outer class (it wouldn't subclass GeneratedMessageV3), However, QuoteScore which is an actual message would. According to your logs, that would be the one affected:

[ERROR] /path/to/the/project/common/target/generated-sources/com/company/protobuf/Database.java:[58,8] error: cannot find symbol
  symbol:   class UnusedPrivateParameter
  location: class QuoteScore

Without more context, I can't really help you debug this.

Yes you are right. Here (I just mask the name of the company)

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: Database.proto

package com.company.protobuf;

public final class Database {
  private Database() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistryLite registry) {
  }

  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
    registerAllExtensions(
        (com.google.protobuf.ExtensionRegistryLite) registry);
  }
  public interface QuoteScoreOrBuilder extends
      // @@protoc_insertion_point(interface_extends:com.company.protobuf.QuoteScore)
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>int64 quoteId = 1;</code>
     * @return The quoteId.
     */
    long getQuoteId();

    /**
     * <code>string score = 2;</code>
     * @return The score.
     */
    java.lang.String getScore();
    /**
     * <code>string score = 2;</code>
     * @return The bytes for score.
     */
    com.google.protobuf.ByteString
        getScoreBytes();
  }
  /**
   * Protobuf type {@code com.company.protobuf.QuoteScore}
   */
  public static final class QuoteScore extends
      com.google.protobuf.GeneratedMessageV3 implements
      // @@protoc_insertion_point(message_implements:com.company.protobuf.QuoteScore)
      QuoteScoreOrBuilder {
  private static final long serialVersionUID = 0L;
    // Use QuoteScore.newBuilder() to construct.
    private QuoteScore(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
      super(builder);
    }
    private QuoteScore() {
      score_ = "";
    }

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

    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
    getUnknownFields() {
      return this.unknownFields;
    }
    private QuoteScore(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      this();
      if (extensionRegistry == null) {
        throw new java.lang.NullPointerException();
      }
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            case 8: {

              quoteId_ = input.readInt64();
              break;
            }
            case 18: {
              java.lang.String s = input.readStringRequireUtf8();

              score_ = s;
              break;
            }
            default: {
              if (!parseUnknownField(
                  input, unknownFields, extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.company.protobuf.Database.internal_static_com_company_protobuf_QuoteScore_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.company.protobuf.Database.internal_static_com_company_protobuf_QuoteScore_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.company.protobuf.Database.QuoteScore.class, com.company.protobuf.Database.QuoteScore.Builder.class);
    }

    public static final int QUOTEID_FIELD_NUMBER = 1;
    private long quoteId_;
    /**
     * <code>int64 quoteId = 1;</code>
     * @return The quoteId.
     */
    @java.lang.Override
    public long getQuoteId() {
      return quoteId_;
    }

    public static final int SCORE_FIELD_NUMBER = 2;
    private volatile java.lang.Object score_;
    /**
     * <code>string score = 2;</code>
     * @return The score.
     */
    @java.lang.Override
    public java.lang.String getScore() {
      java.lang.Object ref = score_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = 
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        score_ = s;
        return s;
      }
    }
    /**
     * <code>string score = 2;</code>
     * @return The bytes for score.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString
        getScoreBytes() {
      java.lang.Object ref = score_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        score_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    private byte memoizedIsInitialized = -1;
    @java.lang.Override
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized == 1) return true;
      if (isInitialized == 0) return false;

      memoizedIsInitialized = 1;
      return true;
    }

    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      if (quoteId_ != 0L) {
        output.writeInt64(1, quoteId_);
      }
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(score_)) {
        com.google.protobuf.GeneratedMessageV3.writeString(output, 2, score_);
      }
      unknownFields.writeTo(output);
    }

    @java.lang.Override
    public int getSerializedSize() {
      int size = memoizedSize;
      if (size != -1) return size;

      size = 0;
      if (quoteId_ != 0L) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt64Size(1, quoteId_);
      }
      if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(score_)) {
        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, score_);
      }
      size += unknownFields.getSerializedSize();
      memoizedSize = size;
      return size;
    }

    @java.lang.Override
    public boolean equals(final java.lang.Object obj) {
      if (obj == this) {
       return true;
      }
      if (!(obj instanceof com.company.protobuf.Database.QuoteScore)) {
        return super.equals(obj);
      }
      com.company.protobuf.Database.QuoteScore other = (com.company.protobuf.Database.QuoteScore) obj;

      if (getQuoteId()
          != other.getQuoteId()) return false;
      if (!getScore()
          .equals(other.getScore())) return false;
      if (!unknownFields.equals(other.unknownFields)) return false;
      return true;
    }

    @java.lang.Override
    public int hashCode() {
      if (memoizedHashCode != 0) {
        return memoizedHashCode;
      }
      int hash = 41;
      hash = (19 * hash) + getDescriptor().hashCode();
      hash = (37 * hash) + QUOTEID_FIELD_NUMBER;
      hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
          getQuoteId());
      hash = (37 * hash) + SCORE_FIELD_NUMBER;
      hash = (53 * hash) + getScore().hashCode();
      hash = (29 * hash) + unknownFields.hashCode();
      memoizedHashCode = hash;
      return hash;
    }

    public static com.company.protobuf.Database.QuoteScore parseFrom(
        java.nio.ByteBuffer data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static com.company.protobuf.Database.QuoteScore parseFrom(
        java.nio.ByteBuffer data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static com.company.protobuf.Database.QuoteScore parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static com.company.protobuf.Database.QuoteScore parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static com.company.protobuf.Database.QuoteScore parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static com.company.protobuf.Database.QuoteScore parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static com.company.protobuf.Database.QuoteScore parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input);
    }
    public static com.company.protobuf.Database.QuoteScore parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input, extensionRegistry);
    }
    public static com.company.protobuf.Database.QuoteScore parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseDelimitedWithIOException(PARSER, input);
    }
    public static com.company.protobuf.Database.QuoteScore parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
    }
    public static com.company.protobuf.Database.QuoteScore parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input);
    }
    public static com.company.protobuf.Database.QuoteScore parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return com.google.protobuf.GeneratedMessageV3
          .parseWithIOException(PARSER, input, extensionRegistry);
    }

    @java.lang.Override
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder() {
      return DEFAULT_INSTANCE.toBuilder();
    }
    public static Builder newBuilder(com.company.protobuf.Database.QuoteScore prototype) {
      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
    }
    @java.lang.Override
    public Builder toBuilder() {
      return this == DEFAULT_INSTANCE
          ? new Builder() : new Builder().mergeFrom(this);
    }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code com.company.protobuf.QuoteScore}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
        // @@protoc_insertion_point(builder_implements:com.company.protobuf.QuoteScore)
        com.company.protobuf.Database.QuoteScoreOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return com.company.protobuf.Database.internal_static_com_company_protobuf_QuoteScore_descriptor;
      }

      @java.lang.Override
      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.company.protobuf.Database.internal_static_com_company_protobuf_QuoteScore_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.company.protobuf.Database.QuoteScore.class, com.company.protobuf.Database.QuoteScore.Builder.class);
      }

      // Construct using com.company.protobuf.Database.QuoteScore.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessageV3
                .alwaysUseFieldBuilders) {
        }
      }
      @java.lang.Override
      public Builder clear() {
        super.clear();
        quoteId_ = 0L;

        score_ = "";

        return this;
      }

      @java.lang.Override
      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return com.company.protobuf.Database.internal_static_com_company_protobuf_QuoteScore_descriptor;
      }

      @java.lang.Override
      public com.company.protobuf.Database.QuoteScore getDefaultInstanceForType() {
        return com.company.protobuf.Database.QuoteScore.getDefaultInstance();
      }

      @java.lang.Override
      public com.company.protobuf.Database.QuoteScore build() {
        com.company.protobuf.Database.QuoteScore result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      @java.lang.Override
      public com.company.protobuf.Database.QuoteScore buildPartial() {
        com.company.protobuf.Database.QuoteScore result = new com.company.protobuf.Database.QuoteScore(this);
        result.quoteId_ = quoteId_;
        result.score_ = score_;
        onBuilt();
        return result;
      }

      @java.lang.Override
      public Builder clone() {
        return super.clone();
      }
      @java.lang.Override
      public Builder setField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          java.lang.Object value) {
        return super.setField(field, value);
      }
      @java.lang.Override
      public Builder clearField(
          com.google.protobuf.Descriptors.FieldDescriptor field) {
        return super.clearField(field);
      }
      @java.lang.Override
      public Builder clearOneof(
          com.google.protobuf.Descriptors.OneofDescriptor oneof) {
        return super.clearOneof(oneof);
      }
      @java.lang.Override
      public Builder setRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          int index, java.lang.Object value) {
        return super.setRepeatedField(field, index, value);
      }
      @java.lang.Override
      public Builder addRepeatedField(
          com.google.protobuf.Descriptors.FieldDescriptor field,
          java.lang.Object value) {
        return super.addRepeatedField(field, value);
      }
      @java.lang.Override
      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.company.protobuf.Database.QuoteScore) {
          return mergeFrom((com.company.protobuf.Database.QuoteScore)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.company.protobuf.Database.QuoteScore other) {
        if (other == com.company.protobuf.Database.QuoteScore.getDefaultInstance()) return this;
        if (other.getQuoteId() != 0L) {
          setQuoteId(other.getQuoteId());
        }
        if (!other.getScore().isEmpty()) {
          score_ = other.score_;
          onChanged();
        }
        this.mergeUnknownFields(other.unknownFields);
        onChanged();
        return this;
      }

      @java.lang.Override
      public final boolean isInitialized() {
        return true;
      }

      @java.lang.Override
      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        com.company.protobuf.Database.QuoteScore parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (com.company.protobuf.Database.QuoteScore) e.getUnfinishedMessage();
          throw e.unwrapIOException();
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }

      private long quoteId_ ;
      /**
       * <code>int64 quoteId = 1;</code>
       * @return The quoteId.
       */
      @java.lang.Override
      public long getQuoteId() {
        return quoteId_;
      }
      /**
       * <code>int64 quoteId = 1;</code>
       * @param value The quoteId to set.
       * @return This builder for chaining.
       */
      public Builder setQuoteId(long value) {
        
        quoteId_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>int64 quoteId = 1;</code>
       * @return This builder for chaining.
       */
      public Builder clearQuoteId() {
        
        quoteId_ = 0L;
        onChanged();
        return this;
      }

      private java.lang.Object score_ = "";
      /**
       * <code>string score = 2;</code>
       * @return The score.
       */
      public java.lang.String getScore() {
        java.lang.Object ref = score_;
        if (!(ref instanceof java.lang.String)) {
          com.google.protobuf.ByteString bs =
              (com.google.protobuf.ByteString) ref;
          java.lang.String s = bs.toStringUtf8();
          score_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       * <code>string score = 2;</code>
       * @return The bytes for score.
       */
      public com.google.protobuf.ByteString
          getScoreBytes() {
        java.lang.Object ref = score_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b = 
              com.google.protobuf.ByteString.copyFromUtf8(
                  (java.lang.String) ref);
          score_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>string score = 2;</code>
       * @param value The score to set.
       * @return This builder for chaining.
       */
      public Builder setScore(
          java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  
        score_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>string score = 2;</code>
       * @return This builder for chaining.
       */
      public Builder clearScore() {
        
        score_ = getDefaultInstance().getScore();
        onChanged();
        return this;
      }
      /**
       * <code>string score = 2;</code>
       * @param value The bytes for score to set.
       * @return This builder for chaining.
       */
      public Builder setScoreBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
        
        score_ = value;
        onChanged();
        return this;
      }
      @java.lang.Override
      public final Builder setUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
        return super.setUnknownFields(unknownFields);
      }

      @java.lang.Override
      public final Builder mergeUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
        return super.mergeUnknownFields(unknownFields);
      }


      // @@protoc_insertion_point(builder_scope:com.company.protobuf.QuoteScore)
    }

    // @@protoc_insertion_point(class_scope:com.company.protobuf.QuoteScore)
    private static final com.company.protobuf.Database.QuoteScore DEFAULT_INSTANCE;
    static {
      DEFAULT_INSTANCE = new com.company.protobuf.Database.QuoteScore();
    }

    public static com.company.protobuf.Database.QuoteScore getDefaultInstance() {
      return DEFAULT_INSTANCE;
    }

    private static final com.google.protobuf.Parser<QuoteScore>
        PARSER = new com.google.protobuf.AbstractParser<QuoteScore>() {
      @java.lang.Override
      public QuoteScore parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new QuoteScore(input, extensionRegistry);
      }
    };

    public static com.google.protobuf.Parser<QuoteScore> parser() {
      return PARSER;
    }

    @java.lang.Override
    public com.google.protobuf.Parser<QuoteScore> getParserForType() {
      return PARSER;
    }

    @java.lang.Override
    public com.company.protobuf.Database.QuoteScore getDefaultInstanceForType() {
      return DEFAULT_INSTANCE;
    }

  }

  private static final com.google.protobuf.Descriptors.Descriptor
    internal_static_com_company_protobuf_QuoteScore_descriptor;
  private static final 
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_com_company_protobuf_QuoteScore_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static  com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    java.lang.String[] descriptorData = {
      "\n\016Database.proto\022\025com.company.protobuf\"" +
      ",\n\nQuoteScore\022\017\n\007quoteId\030\001 \001(\003\022\r\n\005score\030" +
      "\002 \001(\tB!\n\025com.company.protobufB\010Database" +
      "b\006proto3"
    };
    descriptor = com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
        });
    internal_static_com_company_protobuf_QuoteScore_descriptor =
      getDescriptor().getMessageTypes().get(0);
    internal_static_com_company_protobuf_QuoteScore_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_com_company_protobuf_QuoteScore_descriptor,
        new java.lang.String[] { "QuoteId", "Score", });
  }

  // @@protoc_insertion_point(outer_class_scope)
}

ridvantanik avatar Dec 23 '21 19:12 ridvantanik