Sandy Zhang
2c639334cc
Introduce a legacy utility for Descriptors.java to hide FileDescriptor.getSyntax().
...
This will be used to make the method and enum to package-private and later to visibility-restrict other deprecated APIs for editions to prevent backslide.
PiperOrigin-RevId: 518028723
2 years ago
Protobuf Team Bot
8eac9a031e
Remove loop when skipping string field values.
...
No need for a loop that that calls tryConsumeString or tryConsumeByteString repeatedly, since ConsumeByteString already loops itself.
PiperOrigin-RevId: 517202228
2 years ago
Protobuf Team Bot
d70ddf20d3
Fix lint warnings for protobuf GeneratedMessage.java
...
PiperOrigin-RevId: 516731120
2 years ago
Protobuf Team Bot
44bd03c609
Fix `FieldSet#writeMessageSetTo` to delegate to LazyFields when appropriate.
...
This fixes the following issue:
- In `FieldSet#getMessageSetSerializedSize` we delegate to `LazyField` for getting its size.
- Before this change, in `FieldSet#writeMessageTo` we do not delegate to LazyField's `byteString` method. Instead, we call `getValue` on the `FieldSet`.
- It's not guaranteed that `fieldSet.getSerializedSize() == fieldSet.getValue().getSerializedSize()`.
In particular, this can lead us to run into the message "Serializing com.google.protobuf.DynamicMessage to a byte array threw an IOException (should never happen)" because of mispredicted output size.
We fix the issue by following similar logic to `MessageSetSchema`- if "getSerializedSize" delegates to the LazyField, then the serializer should as well.
PiperOrigin-RevId: 516658372
2 years ago
Protobuf Team Bot
5d97d43863
Internal change.
...
PiperOrigin-RevId: 516635646
2 years ago
Sandy Zhang
6e6d0bce4a
Add Java FileDescriptor.copyHeadingTo() which copies file-level settings (e.g. syntax, package, file options) to FileDescriptorProto.Builder
...
PiperOrigin-RevId: 516635134
2 years ago
zhangskz
b15bf628e5
Merge 22.x back to main ( #12200 )
...
Closes #12200
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/12200 from protocolbuffers:main-202303101853 1efa2e7205
PiperOrigin-RevId: 515722578
2 years ago
Mike Kruskal
25dfc39b11
Internal changes
...
PiperOrigin-RevId: 515648197
2 years ago
Protobuf Team Bot
81f89d509d
Updating version.json and repo version numbers to: 22.2
2 years ago
Deanna Garcia
99ed01009f
Add version to intra proto dependencies and add kotlin stdlib dependency
2 years ago
Deanna Garcia
d80c12d322
Add $ back for osgi header
2 years ago
Protobuf Team Bot
6545c67a08
Fix lint warnings for protobuf GeneratedMessage.java
...
PiperOrigin-RevId: 515240930
2 years ago
deannagarcia
15bd2c21cf
Merge 22.x back to main ( #12169 )
...
Closes #12169
PiperOrigin-RevId: 515161008
2 years ago
Deanna Garcia
8ac2337595
Remove $ in pom files
2 years ago
Protobuf Team Bot
839e8d25ea
Updating version.json and repo version numbers to: 22.1
2 years ago
Mike Kruskal
c440da9e13
Remove unnecessary has bits from proto2 Java.
...
Message fields in oneofs generate has bits in their parent message, but these are never used.
PiperOrigin-RevId: 514754886
2 years ago
Sandy Zhang
7e2ccc3e2f
Internal change
...
PiperOrigin-RevId: 514732984
2 years ago
Protobuf Team Bot
d27df92884
Internal change
...
PiperOrigin-RevId: 512993970
2 years ago
Deanna Garcia
66f80c3610
Remove errorprone dependency from kotlin protos.
...
PiperOrigin-RevId: 512960332
2 years ago
Deanna Garcia
7b6e828215
Remove errorprone dependency from kotlin protos.
...
PiperOrigin-RevId: 512960332
2 years ago
Sandy Zhang
97c1e2968a
Make public FieldDescriptor.legacyEnumFieldTreatedAsClosed()
...
PiperOrigin-RevId: 512708108
2 years ago
Sandy Zhang
343cef1bd9
Replace FileDescriptor.supportsUnknownEnumValues() with FieldDescriptor.legacyEnumFieldTreatedAsClosed() to support legacy enum field behavior.
...
This documents Java's non-conformant behavior where closedness is determined by the field rather than the enum definition.
PiperOrigin-RevId: 512627297
2 years ago
deannagarcia
ae97c826f7
Fix potential null pointer error
2 years ago
deannagarcia
075677e415
Compare strings better
2 years ago
deannagarcia
5ffb29d684
Debug java version test
2 years ago
Deanna Garcia
27c7319106
Fix java version test
2 years ago
Deanna Garcia
1456462a14
Add java8 tests and build flags
2 years ago
Jerry Berg
a2e33e79e9
Java fixes for 22.x ( #12035 )
...
* Fix mutability bug in Java proto lite: sub-messages inside of oneofs were not
being set as immutable. This would allow code to get a builder for a
sub-message and modify the original (supposedly immutable) copy.
PiperOrigin-RevId: 511598810
* Add casts to make protobuf compatible with Java 1.8 runtime.
Fix for: https://github.com/protocolbuffers/protobuf/issues/11393
PiperOrigin-RevId: 511807920
---------
Co-authored-by: Protobuf Team Bot <protobuf-github-bot@google.com>
2 years ago
Protobuf Team Bot
d40aadf823
Add casts to make protobuf compatible with Java 1.8 runtime.
...
Fix for: https://github.com/protocolbuffers/protobuf/issues/11393
PiperOrigin-RevId: 511807920
2 years ago
Sandy Zhang
541914157e
Migrate away from examining the syntax of a proto file via reflection.
...
PiperOrigin-RevId: 511806036
2 years ago
Deanna Garcia
e909bfc517
Add OSGi headers to pom files.
...
This addresses https://github.com/protocolbuffers/protobuf/issues/12017 .
PiperOrigin-RevId: 511587640
2 years ago
Sandy Zhang
2a55706f9d
Migrate away from examining the syntax of a proto file via reflection.
...
PiperOrigin-RevId: 511796130
2 years ago
Sandy Zhang
684a3dedf6
Migrate away from examining the syntax of a proto file via reflection.
...
PiperOrigin-RevId: 511792205
2 years ago
Protobuf Team Bot
fa82155c65
Fix mutability bug in Java proto lite: sub-messages inside of oneofs were not
...
being set as immutable. This would allow code to get a builder for a
sub-message and modify the original (supposedly immutable) copy.
PiperOrigin-RevId: 511598810
2 years ago
Protobuf Team Bot
dbd5ae8593
Allow AbstractProtoList to be created in an immutable state rather than using static blocks to call makeImmutable.
...
PiperOrigin-RevId: 511587750
2 years ago
Deanna Garcia
d3ceff3def
Add OSGi headers to pom files.
...
This addresses https://github.com/protocolbuffers/protobuf/issues/12017 .
PiperOrigin-RevId: 511587640
2 years ago
Sandy Zhang
b51858aa11
Document that hasField is only semantically meaningful when hasPresence == True.
...
Note that this is already documented in hasPresence as well.
PiperOrigin-RevId: 511316345
2 years ago
deannagarcia
9ee7b565c2
Fix pom_template dependencies. All pom files need a dependency section and kotlin + util need to depend on protobuf-java and kotlin-lite should depend on protobuf-javalite. ( #12009 )
...
This fixes https://github.com/protocolbuffers/protobuf/issues/11976
PiperOrigin-RevId: 511252224
2 years ago
Deanna Garcia
9b5a2c6f6f
Fix pom_template dependencies. All pom files need a dependency section and kotlin + util need to depend on protobuf-java and kotlin-lite should depend on protobuf-javalite.
...
This fixes https://github.com/protocolbuffers/protobuf/issues/11976
PiperOrigin-RevId: 511252224
2 years ago
Protobuf Team Bot
6d776dfed5
protobuf: fix a data race in AbstractProtobufList
...
Unconditional update of isMutable causes data races for
LazyStringArrayList::EMPTY_LIST that is used as the default value
for protobuf fields.
Not writing to it unconditionally may also improve performance
by reducing contention for the presumably widely shared EMPTY_LIST object.
PiperOrigin-RevId: 510366298
2 years ago
Mike Kruskal
649cc30872
Open-source some of our string_view tests.
...
This support was added in 22.x, but we don't have any tests locking it down.
Closes https://github.com/protocolbuffers/protobuf/issues/8096
PiperOrigin-RevId: 510242380
2 years ago
Protobuf Team Bot
a847a8dc4b
Updating version.json and repo version numbers to: 22.0
2 years ago
Protobuf Team Bot
c4ed948314
Fix lint warnings for protobuf GeneratedMessage.java
...
PiperOrigin-RevId: 509989425
2 years ago
Protobuf Team Bot
a594141cc4
Document known quirks of EnumDescriptor::is_closed() when importing across files with different syntaxes.
...
PiperOrigin-RevId: 509581394
2 years ago
Protobuf Team Bot
1de344fcd1
Document known quirks of EnumDescriptor::is_closed() when importing across files with different syntaxes.
...
PiperOrigin-RevId: 509581394
2 years ago
Protobuf Team Bot
4dd7a1e380
Updating version.json and repo version numbers to: 22.0-rc3
2 years ago
Protobuf Team Bot
1d744d40c8
Fix lint warnings for protobuf GeneratedMessage.java
...
PiperOrigin-RevId: 507937400
2 years ago
Deanna Garcia
5137f693d2
Update java pom files with new developer and website.
...
PiperOrigin-RevId: 507851798
2 years ago
Sandy Zhang
d1b86601a2
Add isClosed() to EnumDescriptor in Java.
...
PiperOrigin-RevId: 507489971
2 years ago
Adam Cozzette
1325913afd
Add Java support for retention attribute
...
PiperOrigin-RevId: 506760540
2 years ago