Sandy Zhang
274bc7f26f
Move java_features.proto to java/core/srce/main/resources
...
This also fixes maven to package this correctly as google/protobuf/java_features.proto (same dir as WKT/descriptor.proto) instead of com/google/protobuf/java_features.proto.
Fixes https://github.com/protocolbuffers/protobuf/issues/16155
PiperOrigin-RevId: 619015714
8 months ago
Liam Miller-Cushon
b36458fd80
Make `NioByteString` private member class of `ByteString`
...
PiperOrigin-RevId: 618910772
8 months ago
Sandy Zhang
9ce51d1ed8
Set label to REQUIRED for descriptors with LEGACY_REQUIRED feature.
...
Ensures isOptional() does not return true for LEGACY_REQUIRED fields which would otherwise get the optional label applied by default (non-optional fields still get the optional label).
Adds validation to feature resolution instead of cross link, which is too early to have FieldPresence.LEGACY_REQUIRED resolved.
PiperOrigin-RevId: 618857590
8 months ago
Sandy Zhang
369732a581
Add java_features.proto to kotlin_mvn release
...
PiperOrigin-RevId: 618295219
9 months ago
Sandy Zhang
500c953d10
Enable editions support for Java Lite.
...
java_features.proto and descriptor.proto should now both be included in the Java Lite and Kotlin Lite maven releases.
Fixes https://github.com/protocolbuffers/protobuf/issues/7331
PiperOrigin-RevId: 618251348
9 months ago
Protobuf Team Bot
821e854b5a
Automated Code Change
...
PiperOrigin-RevId: 617984990
9 months ago
Mike Kruskal
0e167e796f
Disallow all feature types except enum and boolean.
...
Features are designed as temporary migration tools, and any unbounded type leaves the system open to unexpected use. Features should have a fixed set of values, with well defined behaviors.
PiperOrigin-RevId: 617933544
9 months ago
Sandy Zhang
925de189ec
Fix mistake in osgi.bzl to actually use list source_jars.
...
Bazel 7 updated java_out.source_jars to return a Depset.
Release images are still on Bazel 6, but cloudtops were updated to Bazel 7 already.
PiperOrigin-RevId: 617253874
9 months ago
Liam Miller-Cushon
2c07ea5317
Suppress a warning about a class initializer cycle
...
PiperOrigin-RevId: 616953542
9 months ago
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
9 months ago
Sandy Zhang
1e808d5ece
Remove extra whitespace line in JavaEditionDefaults template
...
PiperOrigin-RevId: 616261718
9 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
10 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
10 months ago
Protobuf Team Bot
976a6eb6a4
Rolling back while figuring out why some tests failed.
...
PiperOrigin-RevId: 607458035
10 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
10 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
11 months ago
Protobuf Team Bot
6f86726f26
Rollback version validations in Protobuf Java Lite.
...
PiperOrigin-RevId: 601122259
11 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
11 months ago
Protobuf Team Bot
659b3e7102
Internal changes.
...
PiperOrigin-RevId: 600609161
11 months ago
Protobuf Team Bot
787447430f
Breaking Change: Remove unused helper methods for creating new mutable arraylists.
...
PiperOrigin-RevId: 600581644
11 months ago
Sandy Zhang
35a6730e61
Add private constructor for JavaEditionDefaults template
...
PiperOrigin-RevId: 600548126
11 months ago
Sandy Zhang
882e7843de
Mark descriptor features as volatile to avoid data races in double-checked locking
...
PiperOrigin-RevId: 600547519
11 months ago
Protobuf Team Bot
8b92099937
Checks that only lite or full binding could exist in a process.
...
PiperOrigin-RevId: 600537100
11 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
11 months ago
Protobuf Team Bot
c0d08bdcad
Breaking Change: Stop generating the "newInstance" method. This is not used anymore.
...
PiperOrigin-RevId: 600123108
11 months ago
Protobuf Team Bot
adacf6d0e1
Use char indexOf rather than String, which can have a fast path implementation
...
PiperOrigin-RevId: 599529561
11 months ago
Protobuf Team Bot
979c39178b
Format CodedInputStream & Test
...
PiperOrigin-RevId: 599528929
11 months ago