Skip to content

Fix compatibility issues with 3.22 gencode #18798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 11, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
import com.google.protobuf.Descriptors.Descriptor;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.Descriptors.OneofDescriptor;
import com.google.protobuf.Internal.BooleanList;
import com.google.protobuf.Internal.DoubleList;
import com.google.protobuf.Internal.FloatList;
import com.google.protobuf.Internal.IntList;
import com.google.protobuf.Internal.LongList;
import java.util.List;

/**
Expand All @@ -36,6 +41,46 @@ protected GeneratedMessageV3(Builder<?> builder) {
super(builder);
}

/* @deprecated This method is deprecated, and slated for removal in the next Java breaking change
* (5.x). Users should update gencode to >= 4.26.x which uses makeMutableCopy() instead.
*/
@Deprecated
protected static IntList mutableCopy(IntList list) {
return makeMutableCopy(list);
}

/* @deprecated This method is deprecated, and slated for removal in the next Java breaking change
* (5.x). Users should update gencode to >= 4.26.x which uses makeMutableCopy() instead.
*/
@Deprecated
protected static LongList mutableCopy(LongList list) {
return makeMutableCopy(list);
}

/* @deprecated This method is deprecated, and slated for removal in the next Java breaking change
* (5.x). Users should update gencode to >= 4.26.x which uses makeMutableCopy() instead.
*/
@Deprecated
protected static FloatList mutableCopy(FloatList list) {
return makeMutableCopy(list);
}

/* @deprecated This method is deprecated, and slated for removal in the next Java breaking change
* (5.x). Users should update gencode to >= 4.26.x which uses makeMutableCopy() instead.
*/
@Deprecated
protected static DoubleList mutableCopy(DoubleList list) {
return makeMutableCopy(list);
}

/* @deprecated This method is deprecated, and slated for removal in the next Java breaking change
* (5.x). Users should update gencode to >= 4.26.x which uses makeMutableCopy() instead.
*/
@Deprecated
protected static BooleanList mutableCopy(BooleanList list) {
return makeMutableCopy(list);
}

/* Overrides abstract GeneratedMessage.internalGetFieldAccessorTable().
*
* @deprecated This method is deprecated, and slated for removal in the next Java breaking change
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,35 @@ public Printer usingTypeRegistry(com.google.protobuf.TypeRegistry registry) {
sortingMapKeys);
}

/**
* Creates a new {@link Printer} that will always print fields unless they are a message type or
* in a oneof.
*
* <p>Note that this does print Proto2 Optional but does not print Proto3 Optional fields, as
* the latter is represented using a synthetic oneof.
*
* <p>The new Printer clones all other configurations from the current {@link Printer}.
*
* @deprecated This method is deprecated, and slated for removal in the next Java breaking
* change (5.x). Prefer {@link #alwaysPrintFieldsWithNoPresence}
*/
@Deprecated
public Printer includingDefaultValueFields() {
if (shouldPrintDefaults != ShouldPrintDefaults.ONLY_IF_PRESENT) {
throw new IllegalStateException(
"JsonFormat includingDefaultValueFields has already been set.");
}
return new Printer(
registry,
oldRegistry,
ShouldPrintDefaults.ALWAYS_PRINT_EXCEPT_MESSAGES_AND_ONEOFS,
ImmutableSet.of(),
preservingProtoFieldNames,
omittingInsignificantWhitespace,
printingEnumsAsInts,
sortingMapKeys);
}

/**
* Creates a new {@link Printer} that will also print default-valued fields if their
* FieldDescriptors are found in the supplied set. Empty repeated fields and map fields will be
Expand Down
Loading