Sam Gammon
742ddf1155
fix(java): fixup test codegen for maven build ( #16176 )
...
## Summary
Fixes and closes protocolbuffers/protobuf#16170 by adding missing test-gen mappings and exclusions. Recent [changes](https://github.com/protocolbuffers/protobuf/pull/15362 ) to Protocol Buffers, along with the addition of the _Editions_ feature, have evolved ahead of Maven; running the build on `main` shows build errors related to the testsuite.
## Changelog
- fix: missing test-gen mappings
- fix: missing test exclusions
Closes #16176
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/16176 from sgammon:fix/issue-16170 2be118cf9a
PiperOrigin-RevId: 616310039
8 months ago
Sandy Zhang
1e808d5ece
Remove extra whitespace line in JavaEditionDefaults template
...
PiperOrigin-RevId: 616261718
8 months ago
Mike Kruskal
dc484c131e
Fix has_presence to account for proto3 extensions in Java.
...
PiperOrigin-RevId: 613373080
9 months ago
Protobuf Team Bot
f1d3f28eca
Automated rollback of commit 976a6eb6a4
.
...
PiperOrigin-RevId: 613296331
9 months ago
Sandy Zhang
9f001a9658
Fix descriptor to access type via getType() s.t. messages using delimited encoding are consistently treated as groups for Java lite.
...
This should fix InvalidWireTypeException in the case of getLiteType() not treating messages with delimited encoding as groups: http://shortn/_2TEPuwIj6P
getJavaType() and needsUtf8Check() changes are no-ops since the type is the same regardless, but these are updated for consistency.
PiperOrigin-RevId: 612972996
9 months ago
Protobuf Team Bot
0070ac1188
Make UnsafeByteOperations stable; removing experimental annotation.
...
PiperOrigin-RevId: 610787227
9 months ago
Sandy Zhang
8a17f5ddeb
Resolve features directly in setProto instead of temporarily setting to null.
...
Avoid potential races with other threads reading features that do not share a lock while features are temporarily null.
Special handling for proto1 mutable should not actually be needed, since setProto doesn't update dependency protos.
PiperOrigin-RevId: 610783483
9 months ago
Sandy Zhang
eb10ebd169
Fix features inheritance of oneof fields and extensions and fix/move unit tests to actually run.
...
JUnit4 does not support nested tests so these weren't running. Fixes setup problems and test logic. Oneof fields now inherit from their oneof, and top-level extensions inherit from top-level file when parent descriptor is null.
PiperOrigin-RevId: 609840087
9 months ago
Protobuf Team Bot
5d876c9fec
Point to released versions in Java Protobuf (lite) READMEs instead of the the next, unreleased version.
...
https://github.com/protocolbuffers/protobuf/issues/15878
PiperOrigin-RevId: 609488730
9 months ago
Protobuf Team Bot
976a6eb6a4
Rolling back while figuring out why some tests failed.
...
PiperOrigin-RevId: 607458035
9 months ago
Protobuf Team Bot
1f9b71e9dd
Check if the number of seconds is valid for a timestamp before creating a
...
normalized timestamp.
Without this change, an input of `9223372036854775807, 2` leads to a java.lang.ArithmeticException: overflow.
PiperOrigin-RevId: 607359958
9 months ago
Ian Baker
89bea36856
Document that `Timestamps.parse` might emit zero fractional digits
...
PiperOrigin-RevId: 606870523
10 months ago
aiuto
3ab1276bbb
Update Bazel references to rules_pkg to the supported file locations. ( #15780 )
...
WIP: I want to see this pass CI first.
Fixes : #15779
3 scripted transforms:
```
-load("@rules_pkg//:mappings.bzl", ...)
+load("@rules_pkg//pkg:mappings.bzl", ...)
```
```
-load("@rules_pkg//:pkg.bzl", "pkg_tar")
+load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
```
```
-load("@rules_pkg//:pkg.bzl", "pkg_zip")
+load("@rules_pkg//pkg:zip.bzl", "pkg_zip")
```
Closes #15780
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/15780 from aiuto:rules_pkg a630276341
PiperOrigin-RevId: 606641398
10 months ago
Jiri Pechanec
c98bdc2bdc
Add missing generated file ( #15693 )
...
The proto file is required for Java test. Otherwise it fails with
```
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:testCompile (default-testCompile) on project protobuf-java: Compilation failure: Compilation failure:
[ERROR] /tmp/protocolbuffers-protobuf-3.25.2/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java:[46,25] cannot find symbol
[ERROR] symbol: class UnittestRetention
[ERROR] location: package protobuf_unittest
[ERROR] /tmp/protocolbuffers-protobuf-3.25.2/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java:[550,27] cannot find symbol
[ERROR] symbol: variable UnittestRetention
[ERROR] location: class com.google.protobuf.DescriptorsTest
[ERROR] /tmp/protocolbuffers-protobuf-3.25.2/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java:[551,37] cannot find symbol
[ERROR] symbol: variable UnittestRetention
[ERROR] location: class com.google.protobuf.DescriptorsTest
[ERROR] /tmp/protocolbuffers-protobuf-3.25.2/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java:[552,37] cannot find symbol
[ERROR] symbol: variable UnittestRetention
[ERROR] location: class com.google.protobuf.DescriptorsTest
[ERROR] /tmp/protocolbuffers-protobuf-3.25.2/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java:[553,37] cannot find symbol
[ERROR] symbol: variable UnittestRetention
[ERROR] location: class com.google.protobuf.DescriptorsTest
[ERROR] -> [Help 1]
```
Closes #15693
COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/15693 from jpechane:add-missing-file 9293fabf1f
PiperOrigin-RevId: 604518500
10 months ago
Luke Sandberg
5d4fd7ef84
Clarify docs on MapFieldReflectionAccessorInternal and add tests for the mutability of lists returned from `getAllFields()`
...
PiperOrigin-RevId: 604508075
10 months ago
Chris Kennelly
34a04c1fd5
Remove lazy=true from repeated fields.
...
This is currently a no-op in protoc.
PiperOrigin-RevId: 604457261
10 months ago
Protobuf Team Bot
2699579875
Breaking change: Remove the deprecated always_print_primitive_fields option from Java, Python and C++ JSON parsers.
...
The replacement always_print_without_presence_fields should be used instead, which is very similar but has consistent handling of optional fields by not affecting them.
PiperOrigin-RevId: 604381178
10 months ago
Protobuf Team Bot
986d691d77
use "proto3_optional" option as signal that a field has presence.
...
This is technically redundant with the synthetic oneof container, but simplifies some tooling.
PiperOrigin-RevId: 604368850
10 months ago
Protobuf Team Bot
7d43131a0a
Rename the 'includingDefaultValueWithoutPresenceFields' and 'always_print_without_presence_fields' to 'alwaysPrintFieldsWithNoPresence' in the Cpp, Py and Java JSON serializers for consistency.
...
PiperOrigin-RevId: 604292220
10 months ago
Sandy Zhang
2faa9d1a5f
Force descriptor initialization of dependencies *before* internalUpdateFileDescriptor().
...
This fixes an edge-case where EnumDescriptor for a custom option may be unresolved if used in the same file, since adding the field to ExtensionRegistry doesn't trigger its static init block if the Enum is imported from a dependency.
Also renames feature resolution methods exposed from gencode. Private resolveAllFeaturesInternal() method may be renamed back to resolveAllFeatures() in a followup change.
PiperOrigin-RevId: 603852391
10 months ago
Sandy Zhang
9252b64ef3
Automated rollback of commit 0ee34d35de
.
...
PiperOrigin-RevId: 603802046
10 months ago
Protobuf Team Bot
3924ea28cc
Automated rollback of commit 531d4372f4
.
...
PiperOrigin-RevId: 603728275
10 months ago
lowasser
0ee34d35de
Simplify (and optimize) Descriptors.FileDescriptor.latin1Cat.
...
PiperOrigin-RevId: 603529248
10 months ago
Protobuf Team Bot
d111589bc0
Add a new 'includingDefaultValueWithoutPresenceFields' option to the Java parser which is intended to replace the current 'includingDefaultValueFields'.
...
The old flag accidentally had inconsistent behavior between proto2 optional and proto3 optional fields, the new flag treats them consistently (and is consistent with the preexisting behavior of the Go JSON serializer).
includingDefaultValueFields is now deprecated and will be removed in an upcoming release.
PiperOrigin-RevId: 603449195
10 months ago
Protobuf Team Bot
44ec9d9e86
Automated rollback of commit 58baeb4c3b
.
...
PiperOrigin-RevId: 602770552
10 months ago
Luke Sandberg
531d4372f4
Internal change
...
PiperOrigin-RevId: 602736730
10 months ago
Protobuf Team Bot
58baeb4c3b
Add a new 'includingDefaultValueWithoutPresenceFields' option to the Java parser which is intended to replace the current 'includingDefaultValueFields'.
...
The old flag accidentally had inconsistent behavior between proto2 optional and proto3 optional fields, the new flag treats them consistently (and is consistent with the preexisting behavior of the Go JSON serializer).
PiperOrigin-RevId: 602711486
10 months ago
Sandy Zhang
85938aa654
Update internalUpdateFileDescriptor() to synchronize setProto() and resolveAllFeatures() to avoid data races.
...
PiperOrigin-RevId: 601628994
10 months ago
Dennis Shao
9146ce6ddb
Updating version.json and repo version numbers to: 27-dev ( #15590 )
...
Closes #15590
PiperOrigin-RevId: 601468713
10 months ago
Sandy Zhang
17729cc5e5
Call ExtensionRegistry.add for JavaFeaturesProto.java directly.
...
PiperOrigin-RevId: 601200193
10 months ago
Protobuf Team Bot
6f86726f26
Rollback version validations in Protobuf Java Lite.
...
PiperOrigin-RevId: 601122259
10 months ago
Sandy Zhang
303239d74d
Drop Protobuf support for Android KitKat per EOL and add existing minimum Java 1.8 in Maven pom.xmls
...
See https://android-developers.googleblog.com/2023/07/google-play-services-discontinuing-updates-for-kitkat.html for more details on Android KitKat EOL.
PiperOrigin-RevId: 600609333
10 months ago
Protobuf Team Bot
659b3e7102
Internal changes.
...
PiperOrigin-RevId: 600609161
10 months ago
Protobuf Team Bot
787447430f
Breaking Change: Remove unused helper methods for creating new mutable arraylists.
...
PiperOrigin-RevId: 600581644
10 months ago
Sandy Zhang
35a6730e61
Add private constructor for JavaEditionDefaults template
...
PiperOrigin-RevId: 600548126
10 months ago
Sandy Zhang
882e7843de
Mark descriptor features as volatile to avoid data races in double-checked locking
...
PiperOrigin-RevId: 600547519
10 months ago
Protobuf Team Bot
8b92099937
Checks that only lite or full binding could exist in a process.
...
PiperOrigin-RevId: 600537100
10 months ago
Sandy Zhang
65c65c2d04
Breaking Change: Use Editions features in Java full runtimes.
...
This change breaks compatibility with old generated code from previous major versions per the Cross Version Runtime policy: https://protobuf.dev/support/cross-version-runtime-guarantee . This includes old gencode from <4.26.x, which does not resolve features.
See https://protobuf.dev/news/2023-12-05/
PiperOrigin-RevId: 600487923
10 months ago
Protobuf Team Bot
c0d08bdcad
Breaking Change: Stop generating the "newInstance" method. This is not used anymore.
...
PiperOrigin-RevId: 600123108
10 months ago
Protobuf Team Bot
adacf6d0e1
Use char indexOf rather than String, which can have a fast path implementation
...
PiperOrigin-RevId: 599529561
10 months ago
Protobuf Team Bot
979c39178b
Format CodedInputStream & Test
...
PiperOrigin-RevId: 599528929
10 months ago
Joshua Haberman
9188b39fb7
Shorten our license headers into an abbreviated form that references LICENSE instead of including it in full.
...
PiperOrigin-RevId: 599218886
10 months ago
Protobuf Team Bot
854ca49520
Internal versioning changes.
...
PiperOrigin-RevId: 598625150
11 months ago
Protobuf Team Bot
3b9bd6db71
Breaking Change: Remove unused overload of AbstractMessageLite.addAll that worked on a Collection instead of a List.
...
PiperOrigin-RevId: 597869849
11 months ago
Protobuf Team Bot
9310d2e817
Breaking Change: Remove obsolete runtime internalBuildGeneratedFileFrom which was for backwards compatibility with old gencode.
...
Remove `sentinel.proto` and references to it.
This was announced in https://protobuf.dev/news/2023-12-05/ per our Cross-Version Runtime Guarantees: https://protobuf.dev/support/cross-version-runtime-guarantee/
PiperOrigin-RevId: 597849821
11 months ago
Sandy Zhang
519284a559
Remove LegacyDescriptorsUtil.java and JRuby's use of legacy descriptor APIs
...
This is not a breaking change since this has not been released yet.
PiperOrigin-RevId: 597824548
11 months ago
Protobuf Team Bot
94a2a44851
Breaking Change: remove unnecessary overloads of methods:
...
hasExtension
getExtensionCount
getExtension
PiperOrigin-RevId: 597702196
11 months ago
Protobuf Team Bot
5df0387224
Breaking Change: The base class for generated messages will be
...
GeneratedMessage, not GeneratedMessageV3.
Please rerun protoc on your .proto files to regenerate the binding code.
https://protobuf.dev/news/2023-12-05/
https://protobuf.dev/support/cross-version-runtime-guarantee/
To fix source compatibility with surrounding code make these replacements:
GeneratedMessageV3 --> GeneratedMessage
SingleFieldBuilderV3 --> SingleFieldBuilder
RepeatedFieldBuilderV3 --> RepeatedFieldBuilder
PiperOrigin-RevId: 597642289
11 months ago
Sandy Zhang
63623a688c
Remove public access to Java Edition APIs e.g. getEdition(), getEditionName().
...
Editions should not be used to make semantic decisions -- specific helpers (e.g. FieldDescriptor.hasPresence()) should be used instead. FileDescriptorProto can be used to access editions for *non semantic* purposes, incl. with ProtoFileUti.
These APIs have not been released yet and are thus non-breaking.
PiperOrigin-RevId: 597362543
11 months ago
Sandy Zhang
592ee9b192
Update to call descriptor outer class's getDescriptor() method instead of accessing internal descriptor variable directly.
...
PiperOrigin-RevId: 597355223
11 months ago