Skip to content

Commit

Permalink
Breaking Change: The base class for generated messages will be
Browse files Browse the repository at this point in the history
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
  • Loading branch information
protobuf-github-bot authored and Copybara-Service committed Jan 11, 2024
1 parent 81e5433 commit 5df0387
Show file tree
Hide file tree
Showing 21 changed files with 1,467 additions and 5,063 deletions.
4 changes: 2 additions & 2 deletions java/core/BUILD.bazel
Expand Up @@ -486,10 +486,10 @@ LITE_TEST_EXCLUSIONS = [
"src/test/java/com/google/protobuf/Proto2ExtensionLookupSchemaTest.java",
"src/test/java/com/google/protobuf/Proto2SchemaTest.java",
"src/test/java/com/google/protobuf/Proto2UnknownEnumValueTest.java",
"src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java",
"src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java",
"src/test/java/com/google/protobuf/RuntimeVersionTest.java",
"src/test/java/com/google/protobuf/ServiceTest.java",
"src/test/java/com/google/protobuf/SingleFieldBuilderV3Test.java",
"src/test/java/com/google/protobuf/SingleFieldBuilderTest.java",
"src/test/java/com/google/protobuf/TestBadIdentifiers.java",
"src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java",
"src/test/java/com/google/protobuf/TextFormatParseLocationTest.java",
Expand Down
Expand Up @@ -34,7 +34,7 @@
import java.util.Stack;
import java.util.concurrent.ConcurrentHashMap;

/** A factory for message info based on protobuf descriptors for a {@link GeneratedMessageV3}. */
/** A factory for message info based on protobuf descriptors for a {@link GeneratedMessage}. */
@ExperimentalApi
final class DescriptorMessageInfoFactory implements MessageInfoFactory {
private static final String GET_DEFAULT_INSTANCE_METHOD_NAME = "getDefaultInstance";
Expand Down Expand Up @@ -74,12 +74,12 @@ public static DescriptorMessageInfoFactory getInstance() {

@Override
public boolean isSupported(Class<?> messageType) {
return GeneratedMessageV3.class.isAssignableFrom(messageType);
return GeneratedMessage.class.isAssignableFrom(messageType);
}

@Override
public MessageInfo messageInfoFor(Class<?> messageType) {
if (!GeneratedMessageV3.class.isAssignableFrom(messageType)) {
if (!GeneratedMessage.class.isAssignableFrom(messageType)) {
throw new IllegalArgumentException("Unsupported message type: " + messageType.getName());
}

Expand Down
Expand Up @@ -23,7 +23,7 @@ final class ExtensionSchemaFull extends ExtensionSchema<FieldDescriptor> {

private static <T> long getExtensionsFieldOffset() {
try {
Field field = GeneratedMessageV3.ExtendableMessage.class.getDeclaredField("extensions");
Field field = GeneratedMessage.ExtendableMessage.class.getDeclaredField("extensions");
return UnsafeUtil.objectFieldOffset(field);
} catch (Throwable e) {
throw new IllegalStateException("Unable to lookup extension field offset");
Expand All @@ -32,7 +32,7 @@ private static <T> long getExtensionsFieldOffset() {

@Override
boolean hasExtensions(MessageLite prototype) {
return prototype instanceof GeneratedMessageV3.ExtendableMessage;
return prototype instanceof GeneratedMessage.ExtendableMessage;
}

@Override
Expand Down

0 comments on commit 5df0387

Please sign in to comment.