-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stubs for GeneratedMessageV3, RepeatedFieldBuilderV3, SingleField…
…BuilderV3 for compatibility with older <4.26.x gencode. These classes are deprecated and will be removed in the next breaking change. Users should update gencode to >= 4.26.x which uses GeneratedMessage instead of GeneratedMessageV3. Tested with //compatibility:java_conformance_v3.25.0 which builds the runtime against 3.25.0 gencode. PiperOrigin-RevId: 644136172
- Loading branch information
Showing
5 changed files
with
154 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Protocol Buffers - Google's data interchange format | ||
// Copyright 2008 Google Inc. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file or at | ||
// https://developers.google.com/open-source/licenses/bsd | ||
|
||
package com.google.protobuf; | ||
|
||
import java.util.List; | ||
|
||
import com.google.protobuf.Descriptors.Descriptor; | ||
import com.google.protobuf.Descriptors.FieldDescriptor; | ||
import com.google.protobuf.Extension.ExtensionType; | ||
import com.google.protobuf.GeneratedMessage.ExtendableMessageOrBuilder; | ||
import com.google.protobuf.GeneratedMessage.ExtensionDescriptorRetriever; | ||
import com.google.protobuf.GeneratedMessage.FieldAccessorTable; | ||
|
||
/** | ||
* Stub for GeneratedMessageV3 wrapping GeneratedMessage for compatibility with older gencode. | ||
* | ||
* @deprecated This class is deprecated, and slated for removal in the next Java breaking change | ||
* (5.x in 2025 Q1). Users should update gencode to >= 4.26.x which uses GeneratedMessage | ||
* instead of GeneratedMessageV3. | ||
*/ | ||
@Deprecated | ||
public abstract class GeneratedMessageV3 extends GeneratedMessage { | ||
private static final long serialVersionUID = 1L; | ||
|
||
protected GeneratedMessageV3() { | ||
super(); | ||
} | ||
|
||
protected GeneratedMessageV3(Builder<?> builder) { | ||
super(builder); | ||
} | ||
|
||
/** | ||
* Stub for GeneratedMessageV3.ExtendableBuilder wrapping GeneratedMessage.ExtendableBuilder for | ||
* compatibility with older gencode. | ||
* | ||
* @deprecated This class is deprecated, and slated for removal in the next Java breaking change | ||
* (5.x in 2025 Q1). Users should update gencode to >= 4.26.x which uses | ||
* GeneratedMessage.ExtendableBuilder instead of GeneratedMessageV3.ExtendableBuilder. | ||
*/ | ||
@Deprecated | ||
public abstract static class ExtendableBuilder< | ||
MessageT extends ExtendableMessage<MessageT>, | ||
BuilderT extends ExtendableBuilder<MessageT, BuilderT>> | ||
extends GeneratedMessage.ExtendableBuilder<MessageT, BuilderT> | ||
implements ExtendableMessageOrBuilder<MessageT> { | ||
protected ExtendableBuilder() { | ||
super(); | ||
} | ||
|
||
protected ExtendableBuilder(BuilderParent parent) { | ||
super(parent); | ||
} | ||
|
||
// Support old gencode override method removed in cl/597677225 | ||
public <T> BuilderT setExtension( | ||
final GeneratedMessage.GeneratedExtension<MessageT, T> extension, final T value) { | ||
return setExtension((ExtensionLite<MessageT, T>) extension, value); | ||
} | ||
|
||
// Support old gencode override method removed in cl/597677225 | ||
public <T> BuilderT setExtension( | ||
final GeneratedMessage.GeneratedExtension<MessageT, List<T>> extension, | ||
final int index, | ||
final T value) { | ||
return setExtension((ExtensionLite<MessageT, List<T>>) extension, index, value); | ||
} | ||
|
||
// Support old gencode override method removed in cl/597677225 | ||
public <T> BuilderT addExtension( | ||
final GeneratedMessage.GeneratedExtension<MessageT, List<T>> extension, final T value) { | ||
return addExtension((ExtensionLite<MessageT, List<T>>) extension, value); | ||
} | ||
|
||
// Support old gencode override method removed in cl/597677225 | ||
public <T> BuilderT clearExtension( | ||
final GeneratedMessage.GeneratedExtension<MessageT, T> extension) { | ||
return clearExtension((ExtensionLite<MessageT, T>) extension); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Protocol Buffers - Google's data interchange format | ||
// Copyright 2008 Google Inc. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file or at | ||
// https://developers.google.com/open-source/licenses/bsd | ||
|
||
package com.google.protobuf; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Stub for RepeatedFieldBuilderV3 wrapping RepeatedFieldBuilder for compatibility with older | ||
* gencode. | ||
* | ||
* @deprecated This class is deprecated, and slated for removal in the next breaking change. Users | ||
* should update gencode to >= 4.26.x which replaces RepeatedFieldBuilderV3 with | ||
* RepeatedFieldBuilder. | ||
*/ | ||
@Deprecated | ||
public class RepeatedFieldBuilderV3< | ||
MType extends GeneratedMessage, | ||
BType extends GeneratedMessage.Builder, | ||
IType extends MessageOrBuilder> | ||
extends RepeatedFieldBuilder<MType, BType, IType> { | ||
|
||
public RepeatedFieldBuilderV3( | ||
List<MType> messages, | ||
boolean isMessagesListMutable, | ||
GeneratedMessage.BuilderParent parent, | ||
boolean isClean) { | ||
super(messages, isMessagesListMutable, parent, isClean); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
java/core/src/main/java/com/google/protobuf/SingleFieldBuilderV3.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Protocol Buffers - Google's data interchange format | ||
// Copyright 2008 Google Inc. All rights reserved. | ||
// | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file or at | ||
// https://developers.google.com/open-source/licenses/bsd | ||
|
||
package com.google.protobuf; | ||
|
||
import static com.google.protobuf.Internal.checkNotNull; | ||
|
||
/** | ||
* Stub for SingleFieldBuilderV3 wrapping SingleFieldBuilder for compatibility with older gencode. | ||
* | ||
* @deprecated This class is deprecated, and slated for removal in the next breaking change. Users | ||
* should update gencode to >= 4.26.x which replaces SingleFieldBuilderV3 with | ||
* SingleFieldBuilder. | ||
*/ | ||
@Deprecated | ||
public class SingleFieldBuilderV3< | ||
MType extends GeneratedMessage, | ||
BType extends GeneratedMessage.Builder, | ||
IType extends MessageOrBuilder> | ||
extends SingleFieldBuilder<MType, BType, IType> { | ||
|
||
public SingleFieldBuilderV3( | ||
MType message, GeneratedMessage.BuilderParent parent, boolean isClean) { | ||
super(message, parent, isClean); | ||
} | ||
} |