Comments (10)
I think that ScalaPB should work with recent versions of protobuf-java (such as 3.22.x). Can you share more information about your project? Are you generating Scala and Java code? Are you setting PB.protocVersion
to 3.22.5
? What code path leads to the exception you are seeing? Can you share a minimal project that reproduces this problem?
from scalapb.
Oh so this is just my misunderstanding. I thought I just will not work.
Yes, I have java + scala repo and generating both scala / java classes from proto. So it is safe to use protoc + protobuf-java with version (3.22.5) > currently hardcoded in ScalaPB (3.19.6), is it?
from scalapb.
I haven't tested this specific configuration, so it may or may not work. However, generally it should be ok to use a newer protobuf-java and protoc than the one used with ScalaPB. Please test that and report here you see any issues.
from scalapb.
It looks like protobuf v3.22.0 introduces incompatible change in DescriptorProtos.FieldOptions.Builder setExtension
method: now it is inherited from com.google.protobuf.GeneratedMessageV3.ExtendableBuilder
In 3.19.6 it was presented in DescriptorProtos.FieldOptions.Builder itself
I tried to compile scala proto librarary with current scalapb and protobuf-java + protoc 3.22.5 and get such error:
--scala_out: java.lang.NoSuchMethodError: 'com.google.protobuf.DescriptorProtos$FieldOptions$Builder com.google.protobuf.DescriptorProtos$FieldOptions$Builder.setExtension(com.google.protobuf.GeneratedMessage$GeneratedExtension, java.lang.Object)' at scalapb.compiler.ProtobufGenerator.updateField$1(ProtobufGenerator.scala:1471)
Then I upgrade protobuf (and protoc) in scalapb repo to 3.22.5 and just recompiled compilerplugin. It fixes the problem.
Would you mind to upgrade protobuf to 3.22.5?
from scalapb.
@kusaeva can you provide a minimal project that demonstrates the problem? I prefer to refrain from a releasing a 0.12.0 if not necessary.
from scalapb.
sure, here it is https://github.com/kusaeva/scalapb-protobuf-22.5
Running sbt compile
fails with protobuf 3.22.5 but works with 3.21.7
from scalapb.
Thanks for sending this. It looks like the use of dependencyOverrides
affects the protobuf version used at compile time (!) and I wonder if this is an sbt bug. If you change dependencyOverrides
to libraryDependencies
then it works. Is there a reason for the usage of dependencyOverrides
?
from scalapb.
I used dependencyOverrides just for example. My real project built with bazel, where I have to use certain protobuf version (22.5). And I get the same error
from scalapb.
Got it. I am planning of making a release with a more recent version of protobuf. However, since the problem occurs at compile time, it looks like the generator isn't running in isolation as I thought (we have a custom class loader that was meant to provide that). So upgrading can cause binary incompatibility for users who need the older version at compile time. While we do the new release, care to share a bazel reproduction of the issue? I am not sure how the class loading for the generator works there.
from scalapb.
Sorry for late reply, I've added bazel build to the same repro repository: https://github.com/kusaeva/scalapb-protobuf-22.5
To see the error run: bazel build //:all
from scalapb.
Related Issues (20)
- --jvm_0_out: protoc-gen-jvm_0: Plugin failed with status code 1. WIth Java version 11, change to 17 is fixed HOT 21
- Type Mismatch Error with `asRecognized` in versions 0.11.14 and 0.11.15 HOT 3
- sealed_oneof_companion_extends doesn't work for optional sealed oneof
- Sealed oneof "extend" for Empty case HOT 1
- google/protobuf/empty.proto: File not found. HOT 1
- Define trait for GeneratedEnumCompanion’s fromJavaValue/toJavaValue HOT 1
- Support Scala 3.4 type wildcards HOT 2
- `_typemapper` are defined as package private, causing issues when deriving schemas HOT 4
- Protobuf with a field named using generates invalid Scala 3 code HOT 1
- ArrayIndexOutOfBoundsException on getFieldByNumber HOT 5
- UTF-8 Strings are unparseable? HOT 2
- JsonFormat.toJsonString omits authorisation string in the output JSON HOT 2
- Dependency on `scalapb.options.ScalapbProto` in generated code. HOT 3
- New release HOT 1
- Add an option to generate oneof fields as a sealed abstract class
- pin to protobuf 3.x HOT 1
- Publish scalapb-runtime for Scala Native 0.5.x HOT 3
- Publish new Maven release for v0.11.16 HOT 3
- NullPointerException in __computeSerializedValue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalapb.