Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
dependencies, including well-known types.
- Fix `buf format` non-idempotent trailing comment formatting.
- Update built-in Well-Known Types to Protobuf v35.1.
- Fix managed mode setting `java_multiple_files` on Edition 2024 files, which is not
allowed and causes code generation to fail.

## [v1.72.0] - 2026-07-17

Expand Down
27 changes: 27 additions & 0 deletions private/bufpkg/bufimage/bufimagemodify/bufimagemodify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,33 @@ func TestModifyImageFile(
"bar_all/with_package.proto": {javaPackagePath},
},
},
{
description: "java_multiple_files",
dirPathToFullName: map[string]string{
filepath.Join("testdata", "foo"): "buf.build/acme/foo",
filepath.Join("testdata", "editions"): "buf.build/acme/editions",
},
config: bufconfig.NewGenerateManagedConfig(
true,
[]bufconfig.ManagedDisableRule{},
[]bufconfig.ManagedOverrideRule{},
),
modifyFunc: modifyJavaMultipleFiles,
filePathToExpectedOptions: map[string]*descriptorpb.FileOptions{
"foo_empty/with_package.proto": {
JavaMultipleFiles: new(true),
},
"edition_2023/a.proto": {
JavaMultipleFiles: new(true),
},
// Removed in edition 2024, where it is the default behavior.
"edition_2024/a.proto": nil,
},
filePathToExpectedMarkedLocationPaths: map[string][][]int32{
"foo_empty/with_package.proto": {javaMultipleFilesPath},
"edition_2023/a.proto": {javaMultipleFilesPath},
},
},
{
description: "objc_class_prefix",
dirPathToFullName: map[string]string{
Expand Down
5 changes: 5 additions & 0 deletions private/bufpkg/bufimage/bufimagemodify/file_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,11 @@ func modifyJavaMultipleFiles(
config bufconfig.GenerateManagedConfig,
options ...ModifyOption,
) error {
// The option was removed in edition 2024, where its behavior became the
// default. The latest protoc plugins reject any file that still sets it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error from buf generate:

> buf generate
Failure: invalid_argument: plugin "buf.build/protocolbuffers/java:v36.1" exited with non-zero status 1
stderr:
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1788296414.665177       1 descriptor.cc:1493] foo/v1/foo.proto foo/v1/foo.proto: google.protobuf.FileOptions.java_multiple_files has been removed in edition 2024: This behavior is enabled by default in editions 2024 and above. To disable it, you can set `features.(pb.java).nest_in_file_class = YES` on individual messages, enums, or services.

if imageFile.FileDescriptorProto().GetEdition() >= descriptorpb.Edition_EDITION_2024 {
return nil
}
modifyOptions := newModifyOptions()
for _, option := range options {
option(modifyOptions)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
edition = "2023";

package editions.v2023;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
edition = "2024";

package editions.v2024;
Loading