GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — protobuf 3 compat issues · Issue #1239 · googleapis/google-cloud-java

protobuf 3 compat issues #1239

New issue
Copy link
New issue
Copy link
Closed
Closed
protobuf 3 compat issues#1239
Copy link
Assignees
mziccard

Description

@pcarrier
pcarrier
opened on Sep 10, 2016
Issue body actions
  • datastore-v1-protos ships com.google.protobuf.Timestamp which implements com.google.protobuf.GeneratedMessage
  • protobuf-java 3.0.2 ships com.google.protobuf.Timestamp which implements com.google.protobuf.GeneratedMessageV3
  • As a result, with protobuf-java picked by the classloader, google-cloud-datastore classes (eg com.google.datastore.v1.Value.toBuilder) trigger java.lang.VerifyError (Type 'com/google/protobuf/Timestamp' (current frame, stack[1]) is not assignable to 'com/google/protobuf/GeneratedMessage')
  • Excluding datastore-v1-protos from the classpath and generating the classes from proto ourselves then breaks google-cloud-datastore, eg because of its com/google/cloud/datastore/PathElement.toPb()Lcom/google/protobuf/GeneratedMessage;.

I don't even know where to report this, maybe the protobuf team, but I figured the Google Cloud Platform team was a safer bet given it impacts their customers.

Activity

  1. pcarrier commented on Sep 10, 2016

    @pcarrier
    pcarrier
    on Sep 10, 2016
    Author
    More actions

    FWIW, worked around by:

    • Excluding group: 'com.google.cloud.datastore', module: 'datastore-v1-protos'
    • Instead, generating Java classes with protoc 3.0.2 for:
      • google/datastore/v1/datastore.proto
      • google/datastore/v1/entity.proto
      • google/datastore/v1/query.proto
      • google/type/latlng.proto
    • Shamelessly forking google-cloud-datastore with:
    commit 4370f038b70e329d716684d846099effb9ef2cc7
    Author: Pierre Carrier <[email protected]>
    Date:   2016-09-10 00:31:51 -0700
    
        The Fix
    
    diff --git forks/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Query.java forks/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Query.java
    index eb33c02..7eb7b17 100644
    --- forks/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Query.java
    +++ forks/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Query.java
    @@ -22,6 +22,7 @@ import com.google.common.base.MoreObjects;
     import com.google.common.base.MoreObjects.ToStringHelper;
     import com.google.common.collect.Maps;
     import com.google.protobuf.GeneratedMessage;
    +import com.google.protobuf.GeneratedMessageV3;
     import com.google.protobuf.InvalidProtocolBufferException;
    
     import java.util.Map;
    @@ -38,7 +39,7 @@ import java.util.Map;
      * @param <V> the type of the values returned by this query.
      * @see <a href="https://cloud.google.com/datastore/docs/concepts/queries">Datastore Queries</a>
      */
    -public abstract class Query<V> extends Serializable<GeneratedMessage> {
    +public abstract class Query<V> extends Serializable<GeneratedMessageV3> {
    
       private static final long serialVersionUID = -2748141759901313101L;
    
    diff --git forks/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Serializable.java forks/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Serializable.java
    index 2e30593..3f9205c 100644
    --- forks/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Serializable.java
    +++ forks/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Serializable.java
    @@ -16,7 +16,7 @@
    
     package com.google.cloud.datastore;
    
    -import com.google.protobuf.GeneratedMessage;
    +import com.google.protobuf.GeneratedMessageV3;
     import com.google.protobuf.InvalidProtocolBufferException;
    
     import java.io.IOException;
    @@ -25,7 +25,7 @@ import java.io.ObjectOutputStream;
     import java.io.ObjectStreamException;
     import java.io.StreamCorruptedException;
    
    -abstract class Serializable<M extends GeneratedMessage> implements java.io.Serializable {
    +abstract class Serializable<M extends GeneratedMessageV3> implements java.io.Serializable {
    
       private static final long serialVersionUID = -5565522710061949199L;
    
  2. mziccard commented on Sep 10, 2016

    @mziccard
    mziccard
    on Sep 10, 2016
    Contributor
    More actions

    Hi @pcarrier thanks for the report, the digging, and finding a workaround. protobuf-java was recently released and most of our dependencies still use 3.0.0 betas (which did not include the GeneratedMessageV3 class). I believe you could stumble upon similar issues with other of our modules.

    Sorting this out won't be easy but should at least be possible. Something that we planned to do (haven't had time yet) is to get rid of the Serializable<M extends GeneratedMessage> class, which should at least save you from forking our repos.

    Another issue I see (I might be wrong though), is that datastore-v1-protos define its own com.google.protobuf.* classes, instead of depending on protobuf-java. @eddavisson is there a reason for this? Now that protobuf-java 3.0.0 is out we should depend on it. And if we cannot depend on it for whatever reason, those classes should be shaded. Otherwise we will face the same issues @pcarrier is facing as soon as we switch to protobuf-java 3.0.0 for all Veneer Toolkit services.

    @garrettjonesgoogle I believe the introduction of the GeneratedMessageV3 class could also give you an headache as well. Any plans for switching everything to protobuf v3.0.0? Its important that we coordinate our efforts so that both datastore-v1-protos and VeneerToolkit update to 3.0.0 happen at the same time.

  3. garrettjonesgoogle commented on Sep 12, 2016

    @garrettjonesgoogle
    garrettjonesgoogle
    on Sep 12, 2016
    Contributor
    More actions

    We were going to do the switch within a week or two, but hadn't chosen a specific time for it. Let me know if there is a time that works better than others.

  4. eddavisson commented on Sep 12, 2016

    @eddavisson
    eddavisson
    on Sep 12, 2016
    More actions

    @mziccard I don't remember why we ended up including those com.google.protobuf.* classes, but I agree that it looks like we should be able to pick them up from protobuf-java instead.

    Are any of your other dependencies (e.g. BigQuery) packaging their own generate protocol buffer classes, or do they all use the google-api-services-.* packages?

  5. mziccard commented on Sep 12, 2016

    @mziccard
    mziccard
    on Sep 12, 2016
    Contributor
    More actions

    Are any of your other dependencies (e.g. BigQuery) packaging their own generate protocol buffer classes, or do they all use the google-api-services-.* packages?

    All services on top of gRPC are using their own google-api-services-.* package. I believe VeneerToolkit guys are taking care of releasing them.

  6. eddavisson commented on Sep 12, 2016

    @eddavisson
    eddavisson
    on Sep 12, 2016
    More actions

    Got it. Any plans to switch the Datastore client to gRPC?

  7. mziccard commented on Sep 12, 2016

    @mziccard
    mziccard
    on Sep 12, 2016
    Contributor
    More actions

    No plans yet. Do you believe you can change to use protobuf-java any time soon? You should be able to directly jump diretcty to 3.0.0.

  8. eddavisson commented on Sep 12, 2016

    @eddavisson
    eddavisson
    on Sep 12, 2016
    More actions

    I can have something by the end of the week.

  9. eddavisson commented on Sep 15, 2016

    @eddavisson
    eddavisson
    on Sep 15, 2016
    More actions

    New artifacts that use protobuf-java 3.0.0 (and don't include the com.google.protobuf.* classes):

    <dependency>
      <groupId>com.google.cloud.datastore</groupId>
      <artifactId>datastore-v1-protos</artifactId>
      <version>1.2.0</version>
    </dependency>
    <dependency>
      <groupId>com.google.cloud.datastore</groupId>
      <artifactId>datastore-v1-proto-client</artifactId>
      <version>1.2.0</version>
    </dependency>
    
  10. mziccard commented on Sep 15, 2016

    @mziccard
    mziccard
    on Sep 15, 2016
    Contributor
    More actions

    Thank you @eddavisson, this was fast:)

    I'll go ahead and use the new artifacts as soon as also the VeneerToolkit layer has updated to protobuf-java 3.0.0

  11. mziccard commented on Sep 29, 2016

    @mziccard
    mziccard
    on Sep 29, 2016
    Contributor
    More actions

    @pcarrier this issue should be now fixed in google-cloud 0.4.0. Care to check it out?

  12. mziccard commented on Oct 4, 2016

    @mziccard
    mziccard
    on Oct 4, 2016
    Contributor
    More actions

    I am closing this, please feel free to reopen if you are still experiencing the issue

  13. mziccard
    closed this as completedon Oct 4, 2016
  14. pcarrier commented on Oct 4, 2016

    @pcarrier
    pcarrier
    on Oct 4, 2016
    Author
    More actions

    Checked yesterday, upgrade went smoothly AFAICT. Thanks!

  15. JustinBeckwith
    assigned
    mziccard
    on Feb 1, 2021
  16. github-actions
    added a commit that references this issue on Jun 23, 2022

    deps: update dependency com.google.cloud:google-cloud-bigquery to v2.…

    9c59632
  17. github-actions
    added a commit that references this issue on Jul 1, 2022

    chore(main): release 3.4.0 (googleapis#1232)

    856ea8c
  18. github-actions
    added a commit that references this issue on Sep 15, 2022

    chore: Generated snippets should not be owned by samples reviewers (#…

    0057bee
  19. meltsufin
    added a commit that references this issue on Dec 22, 2025

    chore(main): release 3.14.1-SNAPSHOT (#1239)

    59ba800
  20. chingor13
    added a commit that references this issue on Jan 6, 2026

    chore(main): release 0.130.30-alpha-SNAPSHOT (#1239)

    64838cd
  21. chingor13
    added a commit that references this issue on Jan 22, 2026

    chore: Update sync-repo-settings.yaml for v3-experimental branch (#1239)

    f087f31
  22. chingor13
    added a commit that references this issue on Feb 24, 2026

    docs: Update library definitions in README to the latest version (#1239)

    0c5cff2
  23. suztomo
    added a commit that references this issue on Mar 11, 2026

    chore(main): release 3.14.1-SNAPSHOT (googleapis#1239)

    4cd6833
  24. chingor13
    added a commit that references this issue on Mar 12, 2026

    docs: Update library definitions in README to the latest version (#1239)

    f005193
  25. suztomo
    added a commit that references this issue on Mar 23, 2026

    deps: update dependency com.google.cloud:google-cloud-shared-dependen…

    bb7326f
  26. suztomo
    added 2 commits that reference this issue on Mar 30, 2026

    deps: update dependency com.google.cloud:google-cloud-storage to v2.2…

    87ac305

    chore(main): release 0.127.3 (#1246)

    7bfc891
  27. lqiu96
    added 2 commits that reference this issue on Apr 1, 2026

    deps: update dependency com.google.cloud:google-cloud-storage to v2.2…

    3db9053

    chore(main): release 0.127.3 (#1246)

    d770ca3
  28. benjaminp
    added a commit that references this issue on Jul 13, 2026

    chore(deps): upgrade gapic-generator-java to 2.7.0 and update gax-jav…

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

Metadata

Metadata

Assignees

  • @mziccard
    mziccard

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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.