mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-03-08 19:14:05 +00:00
all: move v1 types over to the v2 repository
As a goal, v2 should not depend on v1. As another step towards that end, we move all the types that used to be in the v1 protoapi package over to v2. For now, we place MessageV1, ExtensionRangeV1, and ExtensionDescV1 in runtime/protoiface since these are types that generated messages will probably have to reference forever. An alternative location could be reflect/protoreflect, but it seems unfortunate to have to dirty the namespace of that package with these types. We move ExtensionFieldV1, ExtensionFieldsV1, and ExtensionFieldsOf to internal/impl, since these are related to the implementation of a generated message. Since moving these types from v1 to v2 implies that the v1 protoapi package is useless, we update all usages of v1 protoapi in the v2 repository to point to the relevant v2 type or functionality. CL/168538 is the corresponding change to alter v1. There will be a temporary build failure as it is not possible to submit CL/168519 and CL/168538 atomically. Change-Id: Ide4025c1b6af5b7f0696f4b65b988b4d10a50f0b Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/168519 Reviewed-by: Herbie Ong <herbie@google.com>
This commit is contained in:
parent
4532dd7969
commit
4fddebafc0
9
cmd/protoc-gen-go-grpc/testdata/go.mod
vendored
9
cmd/protoc-gen-go-grpc/testdata/go.mod
vendored
@ -1,9 +0,0 @@
|
||||
module github.com/golang/protobuf/v2/cmd/protoc-gen-go-grpc/testdata
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.2.1-0.20190311234659-51c19b98ee31
|
||||
github.com/golang/protobuf/v2 v2.0.0
|
||||
google.golang.org/grpc v1.19.0
|
||||
)
|
||||
|
||||
replace github.com/golang/protobuf/v2 => ../../..
|
@ -27,9 +27,14 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
mathPackage = protogen.GoImportPath("math")
|
||||
protoPackage = protogen.GoImportPath("github.com/golang/protobuf/proto")
|
||||
protoapiPackage = protogen.GoImportPath("github.com/golang/protobuf/protoapi")
|
||||
mathPackage = protogen.GoImportPath("math")
|
||||
reflectPackage = protogen.GoImportPath("reflect")
|
||||
protoPackage = protogen.GoImportPath("github.com/golang/protobuf/proto")
|
||||
protoifacePackage = protogen.GoImportPath("github.com/golang/protobuf/v2/runtime/protoiface")
|
||||
protoimplPackage = protogen.GoImportPath("github.com/golang/protobuf/v2/runtime/protoimpl")
|
||||
protoreflectPackage = protogen.GoImportPath("github.com/golang/protobuf/v2/reflect/protoreflect")
|
||||
protoregistryPackage = protogen.GoImportPath("github.com/golang/protobuf/v2/reflect/protoregistry")
|
||||
prototypePackage = protogen.GoImportPath("github.com/golang/protobuf/v2/internal/prototype")
|
||||
)
|
||||
|
||||
type fileInfo struct {
|
||||
@ -46,28 +51,6 @@ type fileInfo struct {
|
||||
allExtensions []*protogen.Extension
|
||||
}
|
||||
|
||||
// protoPackage returns the package to import, which is either the protoPackage
|
||||
// or the protoapiPackage constant.
|
||||
//
|
||||
// This special casing exists because we are unable to move InternalMessageInfo
|
||||
// to protoapi since the implementation behind that logic is heavy and
|
||||
// too intricately connected to other parts of the proto package.
|
||||
// The descriptor proto is special in that it avoids using InternalMessageInfo
|
||||
// so that it is able to depend solely on protoapi and break its dependency
|
||||
// on the proto package. It is still semantically correct for descriptor to
|
||||
// avoid using InternalMessageInfo, but it does incur some performance penalty.
|
||||
// This is acceptable for descriptor, which is a single proto file and is not
|
||||
// known to be in the hot path for any code.
|
||||
//
|
||||
// TODO: Remove this special-casing when the table-driven implementation has
|
||||
// been ported over to v2.
|
||||
func (f *fileInfo) protoPackage() protogen.GoImportPath {
|
||||
if isDescriptor(f.File) {
|
||||
return protoapiPackage
|
||||
}
|
||||
return protoPackage
|
||||
}
|
||||
|
||||
// GenerateFile generates the contents of a .pb.go file.
|
||||
func GenerateFile(gen *protogen.Plugin, file *protogen.File) *protogen.GeneratedFile {
|
||||
filename := file.GeneratedFilenamePrefix + ".pb.go"
|
||||
@ -428,7 +411,7 @@ func genMessage(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, me
|
||||
tags = append(tags, `protobuf_messageset:"1"`)
|
||||
}
|
||||
tags = append(tags, `json:"-"`)
|
||||
g.P(f.protoPackage().Ident("XXX_InternalExtensions"), " `", strings.Join(tags, " "), "`")
|
||||
g.P("XXX_InternalExtensions ", protoimplPackage.Ident("ExtensionFieldsV1"), " `", strings.Join(tags, " "), "`")
|
||||
}
|
||||
g.P("XXX_unrecognized []byte `json:\"-\"`")
|
||||
g.P("XXX_sizecache int32 `json:\"-\"`")
|
||||
@ -444,7 +427,7 @@ func genMessage(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, me
|
||||
if isDescriptor(f.File) {
|
||||
g.P("func (m *", message.GoIdent, ") String() string { return ", protoimplPackage.Ident("X"), ".MessageStringOf(m) }")
|
||||
} else {
|
||||
g.P("func (m *", message.GoIdent, ") String() string { return ", f.protoPackage().Ident("CompactTextString"), "(m) }")
|
||||
g.P("func (m *", message.GoIdent, ") String() string { return ", protoPackage.Ident("CompactTextString"), "(m) }")
|
||||
}
|
||||
// ProtoMessage
|
||||
g.P("func (*", message.GoIdent, ") ProtoMessage() {}")
|
||||
@ -461,7 +444,7 @@ func genMessage(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo, me
|
||||
|
||||
// ExtensionRangeArray
|
||||
if extranges := message.Desc.ExtensionRanges(); extranges.Len() > 0 {
|
||||
protoExtRange := f.protoPackage().Ident("ExtensionRange")
|
||||
protoExtRange := protoifacePackage.Ident("ExtensionRangeV1")
|
||||
extRangeVar := "extRange_" + message.GoIdent.GoName
|
||||
g.P("var ", extRangeVar, " = []", protoExtRange, " {")
|
||||
for i := 0; i < extranges.Len(); i++ {
|
||||
@ -696,7 +679,7 @@ func genExtensions(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo)
|
||||
return
|
||||
}
|
||||
|
||||
g.P("var ", extDecsVarName(f), " = []", f.protoPackage().Ident("ExtensionDesc"), "{")
|
||||
g.P("var ", extDecsVarName(f), " = []", protoifacePackage.Ident("ExtensionDescV1"), "{")
|
||||
for _, extension := range f.allExtensions {
|
||||
// Special case for proto2 message sets: If this extension is extending
|
||||
// proto2.bridge.MessageSet, and its final name component is "message_set_extension",
|
||||
|
@ -23,14 +23,6 @@ func isDescriptor(f *protogen.File) bool {
|
||||
// in the proto package that was introduced in a later version.
|
||||
const minimumVersion = 0
|
||||
|
||||
const (
|
||||
reflectPackage = protogen.GoImportPath("reflect")
|
||||
protoimplPackage = protogen.GoImportPath("github.com/golang/protobuf/v2/runtime/protoimpl")
|
||||
protoreflectPackage = protogen.GoImportPath("github.com/golang/protobuf/v2/reflect/protoreflect")
|
||||
protoregistryPackage = protogen.GoImportPath("github.com/golang/protobuf/v2/reflect/protoregistry")
|
||||
prototypePackage = protogen.GoImportPath("github.com/golang/protobuf/v2/internal/prototype")
|
||||
)
|
||||
|
||||
// TODO: Add support for proto options.
|
||||
|
||||
func genReflectFileDescriptor(gen *protogen.Plugin, g *protogen.GeneratedFile, f *fileInfo) {
|
||||
|
@ -6,16 +6,17 @@ package base
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
type BaseMessage struct {
|
||||
Field *string `protobuf:"bytes,1,opt,name=field" json:"field,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
Field *string `protobuf:"bytes,1,opt,name=field" json:"field,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *BaseMessage) ProtoReflect() protoreflect.Message {
|
||||
@ -30,13 +31,13 @@ func (*BaseMessage) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_extensions_base_base_proto_rawdesc_gzipped, []int{0}
|
||||
}
|
||||
|
||||
var extRange_BaseMessage = []proto.ExtensionRange{
|
||||
var extRange_BaseMessage = []protoiface.ExtensionRangeV1{
|
||||
{Start: 4, End: 9},
|
||||
{Start: 16, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use BaseMessage.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*BaseMessage) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
func (*BaseMessage) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_BaseMessage
|
||||
}
|
||||
|
||||
@ -66,10 +67,10 @@ func (m *BaseMessage) GetField() string {
|
||||
}
|
||||
|
||||
type MessageSetWireFormatMessage struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `protobuf_messageset:"1" json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MessageSetWireFormatMessage) ProtoReflect() protoreflect.Message {
|
||||
@ -84,12 +85,12 @@ func (*MessageSetWireFormatMessage) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_extensions_base_base_proto_rawdesc_gzipped, []int{1}
|
||||
}
|
||||
|
||||
var extRange_MessageSetWireFormatMessage = []proto.ExtensionRange{
|
||||
var extRange_MessageSetWireFormatMessage = []protoiface.ExtensionRangeV1{
|
||||
{Start: 100, End: 2147483646},
|
||||
}
|
||||
|
||||
// Deprecated: Use MessageSetWireFormatMessage.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*MessageSetWireFormatMessage) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
func (*MessageSetWireFormatMessage) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_MessageSetWireFormatMessage
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
base "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/base"
|
||||
extra "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/extensions/extra"
|
||||
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
@ -229,10 +230,10 @@ func (m *RepeatedGroup) GetRepeatedXGroup() []string {
|
||||
|
||||
// An extension of an extension.
|
||||
type Extendable struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Extendable) ProtoReflect() protoreflect.Message {
|
||||
@ -247,12 +248,12 @@ func (*Extendable) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_extensions_ext_ext_proto_rawdesc_gzipped, []int{4}
|
||||
}
|
||||
|
||||
var extRange_Extendable = []proto.ExtensionRange{
|
||||
var extRange_Extendable = []protoiface.ExtensionRangeV1{
|
||||
{Start: 1, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use Extendable.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*Extendable) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
func (*Extendable) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_Extendable
|
||||
}
|
||||
|
||||
@ -387,7 +388,7 @@ func (m *ExtendingMessage_ExtendingMessageSubmessage) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_ExtendingMessage_ExtendingMessageSubmessage proto.InternalMessageInfo
|
||||
|
||||
var xxx_File_extensions_ext_ext_proto_extDescs = []proto.ExtensionDesc{
|
||||
var xxx_File_extensions_ext_ext_proto_extDescs = []protoiface.ExtensionDescV1{
|
||||
{
|
||||
ExtendedType: (*base.BaseMessage)(nil),
|
||||
ExtensionType: (*bool)(nil),
|
||||
|
@ -6,6 +6,7 @@ package proto3
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
|
||||
descriptor "github.com/golang/protobuf/v2/types/descriptor"
|
||||
reflect "reflect"
|
||||
@ -79,7 +80,7 @@ func (m *Message) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_Message proto.InternalMessageInfo
|
||||
|
||||
var xxx_File_extensions_proto3_ext3_proto_extDescs = []proto.ExtensionDesc{
|
||||
var xxx_File_extensions_proto3_ext3_proto_extDescs = []protoiface.ExtensionDescV1{
|
||||
{
|
||||
ExtendedType: (*descriptor.MessageOptions)(nil),
|
||||
ExtensionType: (*bool)(nil),
|
||||
|
8
cmd/protoc-gen-go/testdata/go.mod
vendored
8
cmd/protoc-gen-go/testdata/go.mod
vendored
@ -1,8 +0,0 @@
|
||||
module github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.2.1-0.20190311234659-51c19b98ee31
|
||||
github.com/golang/protobuf/v2 v2.0.0
|
||||
)
|
||||
|
||||
replace github.com/golang/protobuf/v2 => ../../..
|
@ -7,6 +7,7 @@ import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
sub2 "github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata/import_public/sub2"
|
||||
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
|
||||
math "math"
|
||||
reflect "reflect"
|
||||
@ -163,11 +164,11 @@ type M struct {
|
||||
// Types that are valid to be assigned to OneofField:
|
||||
// *M_OneofInt32
|
||||
// *M_OneofInt64
|
||||
OneofField isM_OneofField `protobuf_oneof:"oneof_field"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
OneofField isM_OneofField `protobuf_oneof:"oneof_field"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *M) ProtoReflect() protoreflect.Message {
|
||||
@ -182,12 +183,12 @@ func (*M) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_import_public_sub_a_proto_rawdesc_gzipped, []int{0}
|
||||
}
|
||||
|
||||
var extRange_M = []proto.ExtensionRange{
|
||||
var extRange_M = []protoiface.ExtensionRangeV1{
|
||||
{Start: 100, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use M.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*M) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
func (*M) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_M
|
||||
}
|
||||
|
||||
@ -372,7 +373,7 @@ func (*M_Submessage) XXX_OneofWrappers() []interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
var xxx_File_import_public_sub_a_proto_extDescs = []proto.ExtensionDesc{
|
||||
var xxx_File_import_public_sub_a_proto_extDescs = []protoiface.ExtensionDescV1{
|
||||
{
|
||||
ExtendedType: (*M)(nil),
|
||||
ExtensionType: (*string)(nil),
|
||||
|
@ -9,13 +9,13 @@ import (
|
||||
"testing"
|
||||
|
||||
protoV1 "github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/protoapi"
|
||||
"github.com/golang/protobuf/v2/encoding/jsonpb"
|
||||
"github.com/golang/protobuf/v2/encoding/testprotos/pb2"
|
||||
"github.com/golang/protobuf/v2/encoding/testprotos/pb3"
|
||||
"github.com/golang/protobuf/v2/internal/scalar"
|
||||
"github.com/golang/protobuf/v2/proto"
|
||||
preg "github.com/golang/protobuf/v2/reflect/protoregistry"
|
||||
"github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -42,7 +42,7 @@ func init() {
|
||||
registerExtension(pb2.E_FakeMessageSetExtension_MessageSetExtension)
|
||||
}
|
||||
|
||||
func registerExtension(xd *protoapi.ExtensionDesc) {
|
||||
func registerExtension(xd *protoiface.ExtensionDescV1) {
|
||||
preg.GlobalTypes.Register(xd.Type)
|
||||
}
|
||||
|
||||
|
@ -10,13 +10,13 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/protoapi"
|
||||
"github.com/golang/protobuf/v2/encoding/jsonpb"
|
||||
"github.com/golang/protobuf/v2/internal/encoding/pack"
|
||||
"github.com/golang/protobuf/v2/internal/encoding/wire"
|
||||
"github.com/golang/protobuf/v2/internal/scalar"
|
||||
"github.com/golang/protobuf/v2/proto"
|
||||
preg "github.com/golang/protobuf/v2/reflect/protoregistry"
|
||||
"github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
|
||||
@ -45,7 +45,7 @@ func pb2Enums_NestedEnum(i int32) *pb2.Enums_NestedEnum {
|
||||
return p
|
||||
}
|
||||
|
||||
func setExtension(m proto.Message, xd *protoapi.ExtensionDesc, val interface{}) {
|
||||
func setExtension(m proto.Message, xd *protoiface.ExtensionDescV1, val interface{}) {
|
||||
knownFields := m.ProtoReflect().KnownFields()
|
||||
extTypes := knownFields.ExtensionTypes()
|
||||
extTypes.Register(xd.Type)
|
||||
|
@ -6,6 +6,7 @@ package pb2
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
|
||||
known "github.com/golang/protobuf/v2/types/known"
|
||||
reflect "reflect"
|
||||
@ -849,13 +850,13 @@ func (*IndirectRequired) XXX_OneofWrappers() []interface{} {
|
||||
}
|
||||
|
||||
type Extensions struct {
|
||||
OptString *string `protobuf:"bytes,1,opt,name=opt_string,json=optString" json:"opt_string,omitempty"`
|
||||
OptBool *bool `protobuf:"varint,101,opt,name=opt_bool,json=optBool" json:"opt_bool,omitempty"`
|
||||
OptInt32 *int32 `protobuf:"varint,2,opt,name=opt_int32,json=optInt32" json:"opt_int32,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
OptString *string `protobuf:"bytes,1,opt,name=opt_string,json=optString" json:"opt_string,omitempty"`
|
||||
OptBool *bool `protobuf:"varint,101,opt,name=opt_bool,json=optBool" json:"opt_bool,omitempty"`
|
||||
OptInt32 *int32 `protobuf:"varint,2,opt,name=opt_int32,json=optInt32" json:"opt_int32,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Extensions) ProtoReflect() protoreflect.Message {
|
||||
@ -870,12 +871,12 @@ func (*Extensions) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_pb2_test_proto_rawdesc_gzipped, []int{9}
|
||||
}
|
||||
|
||||
var extRange_Extensions = []proto.ExtensionRange{
|
||||
var extRange_Extensions = []protoiface.ExtensionRangeV1{
|
||||
{Start: 20, End: 100},
|
||||
}
|
||||
|
||||
// Deprecated: Use Extensions.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*Extensions) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
func (*Extensions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_Extensions
|
||||
}
|
||||
|
||||
@ -955,10 +956,10 @@ func (m *ExtensionsContainer) XXX_DiscardUnknown() {
|
||||
var xxx_messageInfo_ExtensionsContainer proto.InternalMessageInfo
|
||||
|
||||
type MessageSet struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
proto.XXX_InternalExtensions `protobuf_messageset:"1" json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `protobuf_messageset:"1" json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MessageSet) ProtoReflect() protoreflect.Message {
|
||||
@ -973,12 +974,12 @@ func (*MessageSet) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_pb2_test_proto_rawdesc_gzipped, []int{11}
|
||||
}
|
||||
|
||||
var extRange_MessageSet = []proto.ExtensionRange{
|
||||
var extRange_MessageSet = []protoiface.ExtensionRangeV1{
|
||||
{Start: 4, End: 2147483646},
|
||||
}
|
||||
|
||||
// Deprecated: Use MessageSet.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*MessageSet) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
func (*MessageSet) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_MessageSet
|
||||
}
|
||||
|
||||
@ -1045,10 +1046,10 @@ func (m *MessageSetExtension) GetOptString() string {
|
||||
}
|
||||
|
||||
type FakeMessageSet struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *FakeMessageSet) ProtoReflect() protoreflect.Message {
|
||||
@ -1063,12 +1064,12 @@ func (*FakeMessageSet) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_pb2_test_proto_rawdesc_gzipped, []int{13}
|
||||
}
|
||||
|
||||
var extRange_FakeMessageSet = []proto.ExtensionRange{
|
||||
var extRange_FakeMessageSet = []protoiface.ExtensionRangeV1{
|
||||
{Start: 4, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use FakeMessageSet.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*FakeMessageSet) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
func (*FakeMessageSet) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_FakeMessageSet
|
||||
}
|
||||
|
||||
@ -1455,7 +1456,7 @@ func (m *Nests_OptGroup_OptNestedGroup) GetOptFixed32() uint32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
var xxx_File_pb2_test_proto_extDescs = []proto.ExtensionDesc{
|
||||
var xxx_File_pb2_test_proto_extDescs = []protoiface.ExtensionDescV1{
|
||||
{
|
||||
ExtendedType: (*Extensions)(nil),
|
||||
ExtensionType: (*bool)(nil),
|
||||
|
@ -9,12 +9,12 @@ import (
|
||||
"testing"
|
||||
|
||||
protoV1 "github.com/golang/protobuf/proto"
|
||||
"github.com/golang/protobuf/protoapi"
|
||||
"github.com/golang/protobuf/v2/encoding/textpb"
|
||||
"github.com/golang/protobuf/v2/internal/legacy"
|
||||
"github.com/golang/protobuf/v2/internal/scalar"
|
||||
"github.com/golang/protobuf/v2/proto"
|
||||
preg "github.com/golang/protobuf/v2/reflect/protoregistry"
|
||||
"github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
|
||||
"github.com/golang/protobuf/v2/encoding/testprotos/pb2"
|
||||
"github.com/golang/protobuf/v2/encoding/testprotos/pb3"
|
||||
@ -45,7 +45,7 @@ func init() {
|
||||
registerExtension(pb2.E_FakeMessageSetExtension_MessageSetExtension)
|
||||
}
|
||||
|
||||
func registerExtension(xd *protoapi.ExtensionDesc) {
|
||||
func registerExtension(xd *protoiface.ExtensionDescV1) {
|
||||
xt := legacy.Export{}.ExtensionTypeFromDesc(xd)
|
||||
preg.GlobalTypes.Register(xt)
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/protobuf/protoapi"
|
||||
"github.com/golang/protobuf/v2/encoding/textpb"
|
||||
"github.com/golang/protobuf/v2/internal/detrand"
|
||||
"github.com/golang/protobuf/v2/internal/encoding/pack"
|
||||
@ -18,6 +17,7 @@ import (
|
||||
"github.com/golang/protobuf/v2/internal/scalar"
|
||||
"github.com/golang/protobuf/v2/proto"
|
||||
preg "github.com/golang/protobuf/v2/reflect/protoregistry"
|
||||
"github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
|
||||
@ -48,7 +48,7 @@ func pb2Enums_NestedEnum(i int32) *pb2.Enums_NestedEnum {
|
||||
return p
|
||||
}
|
||||
|
||||
func setExtension(m proto.Message, xd *protoapi.ExtensionDesc, val interface{}) {
|
||||
func setExtension(m proto.Message, xd *protoiface.ExtensionDescV1, val interface{}) {
|
||||
knownFields := m.ProtoReflect().KnownFields()
|
||||
extTypes := knownFields.ExtensionTypes()
|
||||
extTypes.Register(xd.Type)
|
||||
|
6
go.mod
6
go.mod
@ -1,6 +0,0 @@
|
||||
module github.com/golang/protobuf/v2
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.2.1-0.20190311233832-968e039ade03
|
||||
github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42
|
||||
)
|
4
go.sum
4
go.sum
@ -1,4 +0,0 @@
|
||||
github.com/golang/protobuf v1.2.1-0.20190311233832-968e039ade03 h1:9fMonKrK3A/zUsodyCLUQVFrEDPi/veKKdEemKA8H9k=
|
||||
github.com/golang/protobuf v1.2.1-0.20190311233832-968e039ade03/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42 h1:q3pnF5JFBNRz8sRD+IRj7Y6DMyYGTNqnZ9axTbSfoNI=
|
||||
github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
@ -13,13 +13,13 @@ import (
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
papi "github.com/golang/protobuf/protoapi"
|
||||
pragma "github.com/golang/protobuf/v2/internal/pragma"
|
||||
ptype "github.com/golang/protobuf/v2/internal/prototype"
|
||||
pfmt "github.com/golang/protobuf/v2/internal/typefmt"
|
||||
"github.com/golang/protobuf/v2/proto"
|
||||
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
preg "github.com/golang/protobuf/v2/reflect/protoregistry"
|
||||
piface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
)
|
||||
|
||||
// FileBuilder construct a protoreflect.FileDescriptor from the
|
||||
@ -102,7 +102,7 @@ type FileBuilder struct {
|
||||
// associated v2 ExtensionType and accessible via a pseudo-internal API.
|
||||
// Also, the v2 ExtensionType will be stored into each v1 ExtensionDesc.
|
||||
// If non-nil, len(LegacyExtensions) must equal len(ExtensionOutputTypes).
|
||||
LegacyExtensions []papi.ExtensionDesc
|
||||
LegacyExtensions []piface.ExtensionDescV1
|
||||
|
||||
// EnumOutputTypes is where Init stores all initialized enum types
|
||||
// in "flattened ordering".
|
||||
@ -415,7 +415,7 @@ type (
|
||||
number pref.FieldNumber
|
||||
extendedType pref.MessageDescriptor
|
||||
|
||||
legacyDesc *papi.ExtensionDesc
|
||||
legacyDesc *piface.ExtensionDescV1
|
||||
|
||||
lazy *extensionLazy // protected by fileDesc.once
|
||||
}
|
||||
@ -475,7 +475,7 @@ func (xd *extensionDesc) lazyInit() *extensionLazy {
|
||||
|
||||
// ProtoLegacyExtensionDesc is a pseudo-internal API for allowing the v1 code
|
||||
// to be able to retrieve a v1 ExtensionDesc.
|
||||
func (xd *extensionDesc) ProtoLegacyExtensionDesc() *papi.ExtensionDesc { return xd.legacyDesc }
|
||||
func (xd *extensionDesc) ProtoLegacyExtensionDesc() *piface.ExtensionDescV1 { return xd.legacyDesc }
|
||||
|
||||
type (
|
||||
serviceDesc struct {
|
||||
|
@ -7,6 +7,7 @@ package impl
|
||||
import (
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
"math"
|
||||
|
||||
@ -74,3 +75,19 @@ func (Export) CompressGZIP(in []byte) (out []byte) {
|
||||
out = append(out, gzipFooter[:]...)
|
||||
return out
|
||||
}
|
||||
|
||||
// ExtensionFieldsOf returns an interface abstraction over various
|
||||
// internal representations of extension fields.
|
||||
//
|
||||
// TODO: Delete this once v1 no longer needs to interact with the low-level
|
||||
// extensions data structure.
|
||||
func (Export) ExtensionFieldsOf(p interface{}) legacyExtensionFieldsIface {
|
||||
switch p := p.(type) {
|
||||
case *map[int32]ExtensionFieldV1:
|
||||
return (*legacyExtensionMap)(p)
|
||||
case *ExtensionFieldsV1:
|
||||
return (*legacyExtensionSyncMap)(p)
|
||||
default:
|
||||
panic(fmt.Sprintf("invalid extension fields type: %T", p))
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,10 @@ package impl
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
papi "github.com/golang/protobuf/protoapi"
|
||||
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
piface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
)
|
||||
|
||||
func makeLegacyExtensionFieldsFunc(t reflect.Type) func(p *messageDataType) pref.KnownFields {
|
||||
@ -25,25 +26,25 @@ func makeLegacyExtensionFieldsFunc(t reflect.Type) func(p *messageDataType) pref
|
||||
}
|
||||
|
||||
var (
|
||||
extTypeA = reflect.TypeOf(map[int32]papi.ExtensionField(nil))
|
||||
extTypeB = reflect.TypeOf(papi.XXX_InternalExtensions{})
|
||||
extTypeA = reflect.TypeOf(map[int32]ExtensionFieldV1(nil))
|
||||
extTypeB = reflect.TypeOf(ExtensionFieldsV1{})
|
||||
)
|
||||
|
||||
func makeLegacyExtensionMapFunc(t reflect.Type) func(*messageDataType) papi.ExtensionFields {
|
||||
func makeLegacyExtensionMapFunc(t reflect.Type) func(*messageDataType) legacyExtensionFieldsIface {
|
||||
fx1, _ := t.FieldByName("XXX_extensions")
|
||||
fx2, _ := t.FieldByName("XXX_InternalExtensions")
|
||||
switch {
|
||||
case fx1.Type == extTypeA:
|
||||
fieldOffset := offsetOf(fx1)
|
||||
return func(p *messageDataType) papi.ExtensionFields {
|
||||
return func(p *messageDataType) legacyExtensionFieldsIface {
|
||||
v := p.p.Apply(fieldOffset).AsValueOf(fx1.Type).Interface()
|
||||
return papi.ExtensionFieldsOf(v)
|
||||
return Export{}.ExtensionFieldsOf(v)
|
||||
}
|
||||
case fx2.Type == extTypeB:
|
||||
fieldOffset := offsetOf(fx2)
|
||||
return func(p *messageDataType) papi.ExtensionFields {
|
||||
return func(p *messageDataType) legacyExtensionFieldsIface {
|
||||
v := p.p.Apply(fieldOffset).AsValueOf(fx2.Type).Interface()
|
||||
return papi.ExtensionFieldsOf(v)
|
||||
return Export{}.ExtensionFieldsOf(v)
|
||||
}
|
||||
default:
|
||||
return nil
|
||||
@ -52,11 +53,11 @@ func makeLegacyExtensionMapFunc(t reflect.Type) func(*messageDataType) papi.Exte
|
||||
|
||||
type legacyExtensionFields struct {
|
||||
mi *MessageType
|
||||
x papi.ExtensionFields
|
||||
x legacyExtensionFieldsIface
|
||||
}
|
||||
|
||||
func (p legacyExtensionFields) Len() (n int) {
|
||||
p.x.Range(func(num pref.FieldNumber, _ papi.ExtensionField) bool {
|
||||
p.x.Range(func(num pref.FieldNumber, _ ExtensionFieldV1) bool {
|
||||
if p.Has(pref.FieldNumber(num)) {
|
||||
n++
|
||||
}
|
||||
@ -119,7 +120,7 @@ func (p legacyExtensionFields) Clear(n pref.FieldNumber) {
|
||||
}
|
||||
|
||||
func (p legacyExtensionFields) Range(f func(pref.FieldNumber, pref.Value) bool) {
|
||||
p.x.Range(func(n pref.FieldNumber, x papi.ExtensionField) bool {
|
||||
p.x.Range(func(n pref.FieldNumber, x ExtensionFieldV1) bool {
|
||||
if p.Has(n) {
|
||||
return f(n, p.Get(n))
|
||||
}
|
||||
@ -143,7 +144,7 @@ func (p legacyExtensionFields) ExtensionTypes() pref.ExtensionFieldTypes {
|
||||
type legacyExtensionTypes legacyExtensionFields
|
||||
|
||||
func (p legacyExtensionTypes) Len() (n int) {
|
||||
p.x.Range(func(_ pref.FieldNumber, x papi.ExtensionField) bool {
|
||||
p.x.Range(func(_ pref.FieldNumber, x ExtensionFieldV1) bool {
|
||||
if x.Desc != nil {
|
||||
n++
|
||||
}
|
||||
@ -204,7 +205,7 @@ func (p legacyExtensionTypes) ByNumber(n pref.FieldNumber) pref.ExtensionType {
|
||||
}
|
||||
|
||||
func (p legacyExtensionTypes) ByName(s pref.FullName) (t pref.ExtensionType) {
|
||||
p.x.Range(func(_ pref.FieldNumber, x papi.ExtensionField) bool {
|
||||
p.x.Range(func(_ pref.FieldNumber, x ExtensionFieldV1) bool {
|
||||
if x.Desc != nil && x.Desc.Name == string(s) {
|
||||
t = extensionTypeFromDesc(x.Desc)
|
||||
return false
|
||||
@ -215,7 +216,7 @@ func (p legacyExtensionTypes) ByName(s pref.FullName) (t pref.ExtensionType) {
|
||||
}
|
||||
|
||||
func (p legacyExtensionTypes) Range(f func(pref.ExtensionType) bool) {
|
||||
p.x.Range(func(_ pref.FieldNumber, x papi.ExtensionField) bool {
|
||||
p.x.Range(func(_ pref.FieldNumber, x ExtensionFieldV1) bool {
|
||||
if x.Desc != nil {
|
||||
if !f(extensionTypeFromDesc(x.Desc)) {
|
||||
return false
|
||||
@ -225,8 +226,10 @@ func (p legacyExtensionTypes) Range(f func(pref.ExtensionType) bool) {
|
||||
})
|
||||
}
|
||||
|
||||
func extensionDescFromType(typ pref.ExtensionType) *papi.ExtensionDesc {
|
||||
if xt, ok := typ.(interface{ ProtoLegacyExtensionDesc() *papi.ExtensionDesc }); ok {
|
||||
func extensionDescFromType(typ pref.ExtensionType) *piface.ExtensionDescV1 {
|
||||
if xt, ok := typ.(interface {
|
||||
ProtoLegacyExtensionDesc() *piface.ExtensionDescV1
|
||||
}); ok {
|
||||
if desc := xt.ProtoLegacyExtensionDesc(); desc != nil {
|
||||
return desc
|
||||
}
|
||||
@ -234,9 +237,160 @@ func extensionDescFromType(typ pref.ExtensionType) *papi.ExtensionDesc {
|
||||
return legacyWrapper.ExtensionDescFromType(typ)
|
||||
}
|
||||
|
||||
func extensionTypeFromDesc(desc *papi.ExtensionDesc) pref.ExtensionType {
|
||||
func extensionTypeFromDesc(desc *piface.ExtensionDescV1) pref.ExtensionType {
|
||||
if desc.Type != nil {
|
||||
return desc.Type
|
||||
}
|
||||
return legacyWrapper.ExtensionTypeFromDesc(desc)
|
||||
}
|
||||
|
||||
type legacyExtensionFieldsIface = interface {
|
||||
Len() int
|
||||
Has(pref.FieldNumber) bool
|
||||
Get(pref.FieldNumber) ExtensionFieldV1
|
||||
Set(pref.FieldNumber, ExtensionFieldV1)
|
||||
Clear(pref.FieldNumber)
|
||||
Range(f func(pref.FieldNumber, ExtensionFieldV1) bool)
|
||||
|
||||
// HasInit and Locker are used by v1 GetExtension to provide
|
||||
// an artificial degree of concurrent safety.
|
||||
HasInit() bool
|
||||
sync.Locker
|
||||
}
|
||||
|
||||
type ExtensionFieldV1 struct {
|
||||
// TODO: Unexport these fields when v1 no longer interacts with the
|
||||
// extension data structures directly.
|
||||
|
||||
// When an extension is stored in a message using SetExtension
|
||||
// only desc and value are set. When the message is marshaled
|
||||
// Raw will be set to the encoded form of the message.
|
||||
//
|
||||
// When a message is unmarshaled and contains extensions, each
|
||||
// extension will have only Raw set. When such an extension is
|
||||
// accessed using GetExtension (or GetExtensions) desc and value
|
||||
// will be set.
|
||||
Desc *piface.ExtensionDescV1 // TODO: switch to protoreflect.ExtensionType
|
||||
|
||||
// Value is a concrete value for the extension field. Let the type of
|
||||
// Desc.ExtensionType be the "API type" and the type of Value be the
|
||||
// "storage type". The API type and storage type are the same except:
|
||||
// * for scalars (except []byte), where the API type uses *T,
|
||||
// while the storage type uses T.
|
||||
// * for repeated fields, where the API type uses []T,
|
||||
// while the storage type uses *[]T.
|
||||
//
|
||||
// The reason for the divergence is so that the storage type more naturally
|
||||
// matches what is expected of when retrieving the values through the
|
||||
// protobuf reflection APIs.
|
||||
//
|
||||
// The Value may only be populated if Desc is also populated.
|
||||
Value interface{} // TODO: switch to protoreflect.Value
|
||||
|
||||
// Raw is the raw encoded bytes for the extension field.
|
||||
// It is possible for Raw to be populated irrespective of whether the
|
||||
// other fields are populated.
|
||||
Raw []byte // TODO: switch to protoreflect.RawFields
|
||||
}
|
||||
|
||||
type ExtensionFieldsV1 legacyExtensionSyncMap
|
||||
type legacyExtensionSyncMap struct {
|
||||
p *struct {
|
||||
mu sync.Mutex
|
||||
m legacyExtensionMap
|
||||
}
|
||||
}
|
||||
|
||||
func (m legacyExtensionSyncMap) Len() int {
|
||||
if m.p == nil {
|
||||
return 0
|
||||
}
|
||||
return m.p.m.Len()
|
||||
}
|
||||
func (m legacyExtensionSyncMap) Has(n pref.FieldNumber) bool {
|
||||
if m.p == nil {
|
||||
return false
|
||||
}
|
||||
return m.p.m.Has(n)
|
||||
}
|
||||
func (m legacyExtensionSyncMap) Get(n pref.FieldNumber) ExtensionFieldV1 {
|
||||
if m.p == nil {
|
||||
return ExtensionFieldV1{}
|
||||
}
|
||||
return m.p.m.Get(n)
|
||||
}
|
||||
func (m *legacyExtensionSyncMap) Set(n pref.FieldNumber, x ExtensionFieldV1) {
|
||||
if m.p == nil {
|
||||
m.p = new(struct {
|
||||
mu sync.Mutex
|
||||
m legacyExtensionMap
|
||||
})
|
||||
}
|
||||
m.p.m.Set(n, x)
|
||||
}
|
||||
func (m legacyExtensionSyncMap) Clear(n pref.FieldNumber) {
|
||||
if m.p == nil {
|
||||
return
|
||||
}
|
||||
m.p.m.Clear(n)
|
||||
}
|
||||
func (m legacyExtensionSyncMap) Range(f func(pref.FieldNumber, ExtensionFieldV1) bool) {
|
||||
if m.p == nil {
|
||||
return
|
||||
}
|
||||
m.p.m.Range(f)
|
||||
}
|
||||
|
||||
func (m legacyExtensionSyncMap) HasInit() bool {
|
||||
return m.p != nil
|
||||
}
|
||||
func (m legacyExtensionSyncMap) Lock() {
|
||||
m.p.mu.Lock()
|
||||
}
|
||||
func (m legacyExtensionSyncMap) Unlock() {
|
||||
m.p.mu.Unlock()
|
||||
}
|
||||
|
||||
type legacyExtensionMap map[int32]ExtensionFieldV1
|
||||
|
||||
func (m legacyExtensionMap) Len() int {
|
||||
return len(m)
|
||||
}
|
||||
func (m legacyExtensionMap) Has(n pref.FieldNumber) bool {
|
||||
_, ok := m[int32(n)]
|
||||
return ok
|
||||
}
|
||||
func (m legacyExtensionMap) Get(n pref.FieldNumber) ExtensionFieldV1 {
|
||||
return m[int32(n)]
|
||||
}
|
||||
func (m *legacyExtensionMap) Set(n pref.FieldNumber, x ExtensionFieldV1) {
|
||||
if *m == nil {
|
||||
*m = make(map[int32]ExtensionFieldV1)
|
||||
}
|
||||
(*m)[int32(n)] = x
|
||||
}
|
||||
func (m *legacyExtensionMap) Clear(n pref.FieldNumber) {
|
||||
delete(*m, int32(n))
|
||||
}
|
||||
func (m legacyExtensionMap) Range(f func(pref.FieldNumber, ExtensionFieldV1) bool) {
|
||||
for n, x := range m {
|
||||
if !f(pref.FieldNumber(n), x) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var legacyExtensionLock sync.Mutex
|
||||
|
||||
func (m legacyExtensionMap) HasInit() bool {
|
||||
return m != nil
|
||||
}
|
||||
func (m legacyExtensionMap) Lock() {
|
||||
if !m.HasInit() {
|
||||
panic("cannot lock an uninitialized map")
|
||||
}
|
||||
legacyExtensionLock.Lock()
|
||||
}
|
||||
func (m legacyExtensionMap) Unlock() {
|
||||
legacyExtensionLock.Unlock()
|
||||
}
|
||||
|
@ -10,13 +10,13 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
papi "github.com/golang/protobuf/protoapi"
|
||||
pack "github.com/golang/protobuf/v2/internal/encoding/pack"
|
||||
pimpl "github.com/golang/protobuf/v2/internal/impl"
|
||||
pragma "github.com/golang/protobuf/v2/internal/pragma"
|
||||
ptype "github.com/golang/protobuf/v2/internal/prototype"
|
||||
scalar "github.com/golang/protobuf/v2/internal/scalar"
|
||||
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
piface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
cmp "github.com/google/go-cmp/cmp"
|
||||
cmpopts "github.com/google/go-cmp/cmp/cmpopts"
|
||||
|
||||
@ -28,15 +28,15 @@ import (
|
||||
)
|
||||
|
||||
type legacyTestMessage struct {
|
||||
XXX_unrecognized []byte
|
||||
papi.XXX_InternalExtensions
|
||||
XXX_unrecognized []byte
|
||||
XXX_InternalExtensions pimpl.ExtensionFieldsV1
|
||||
}
|
||||
|
||||
func (*legacyTestMessage) Reset() {}
|
||||
func (*legacyTestMessage) String() string { return "" }
|
||||
func (*legacyTestMessage) ProtoMessage() {}
|
||||
func (*legacyTestMessage) ExtensionRangeArray() []papi.ExtensionRange {
|
||||
return []papi.ExtensionRange{{Start: 10, End: 20}, {Start: 40, End: 80}, {Start: 10000, End: 20000}}
|
||||
func (*legacyTestMessage) ExtensionRangeArray() []piface.ExtensionRangeV1 {
|
||||
return []piface.ExtensionRangeV1{{Start: 10, End: 20}, {Start: 40, End: 80}, {Start: 10000, End: 20000}}
|
||||
}
|
||||
|
||||
func TestLegacyUnknown(t *testing.T) {
|
||||
@ -440,7 +440,7 @@ var (
|
||||
}, (*EnumMessages)(nil)),
|
||||
}
|
||||
|
||||
extensionDescs = []*papi.ExtensionDesc{{
|
||||
extensionDescs = []*piface.ExtensionDescV1{{
|
||||
ExtendedType: (*legacyTestMessage)(nil),
|
||||
ExtensionType: (*bool)(nil),
|
||||
Field: 10000,
|
||||
@ -794,7 +794,7 @@ func TestExtensionConvert(t *testing.T) {
|
||||
}
|
||||
|
||||
opts = cmp.Options{
|
||||
cmpopts.IgnoreFields(papi.ExtensionDesc{}, "Type"),
|
||||
cmpopts.IgnoreFields(piface.ExtensionDescV1{}, "Type"),
|
||||
}
|
||||
if diff := cmp.Diff(wantDesc, gotDesc, opts); diff != "" {
|
||||
t.Errorf("ExtensionDesc mismatch (-want, +got):\n%v", diff)
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
"reflect"
|
||||
"sort"
|
||||
|
||||
papi "github.com/golang/protobuf/protoapi"
|
||||
"github.com/golang/protobuf/v2/internal/encoding/wire"
|
||||
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
)
|
||||
@ -47,13 +46,13 @@ func makeLegacyUnknownFieldsFunc(t reflect.Type) func(p *messageDataType) pref.U
|
||||
// and also the extension field map.
|
||||
type legacyUnknownBytesAndExtensionMap struct {
|
||||
u pref.UnknownFields
|
||||
x papi.ExtensionFields
|
||||
x legacyExtensionFieldsIface
|
||||
r pref.FieldRanges
|
||||
}
|
||||
|
||||
func (fs *legacyUnknownBytesAndExtensionMap) Len() int {
|
||||
n := fs.u.Len()
|
||||
fs.x.Range(func(_ pref.FieldNumber, x papi.ExtensionField) bool {
|
||||
fs.x.Range(func(_ pref.FieldNumber, x ExtensionFieldV1) bool {
|
||||
if len(x.Raw) > 0 {
|
||||
n++
|
||||
}
|
||||
@ -98,7 +97,7 @@ func (fs *legacyUnknownBytesAndExtensionMap) Range(f func(pref.FieldNumber, pref
|
||||
raw pref.RawFields
|
||||
}
|
||||
var xs []entry
|
||||
fs.x.Range(func(n pref.FieldNumber, x papi.ExtensionField) bool {
|
||||
fs.x.Range(func(n pref.FieldNumber, x ExtensionFieldV1) bool {
|
||||
if len(x.Raw) > 0 {
|
||||
xs = append(xs, entry{n, x.Raw})
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ package legacy
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
papi "github.com/golang/protobuf/protoapi"
|
||||
pimpl "github.com/golang/protobuf/v2/internal/impl"
|
||||
pvalue "github.com/golang/protobuf/v2/internal/value"
|
||||
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
piface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
)
|
||||
|
||||
// Export is a zero-length named type that exists only to export a set of
|
||||
@ -37,11 +37,11 @@ func (Export) ExtensionTypeOf(d pref.ExtensionDescriptor, t interface{}) pref.Ex
|
||||
return extensionTypeOf(d, reflect.TypeOf(t))
|
||||
}
|
||||
|
||||
func (Export) ExtensionDescFromType(t pref.ExtensionType) *papi.ExtensionDesc {
|
||||
func (Export) ExtensionDescFromType(t pref.ExtensionType) *piface.ExtensionDescV1 {
|
||||
return extensionDescFromType(t)
|
||||
}
|
||||
|
||||
func (Export) ExtensionTypeFromDesc(d *papi.ExtensionDesc) pref.ExtensionType {
|
||||
func (Export) ExtensionTypeFromDesc(d *piface.ExtensionDescV1) pref.ExtensionType {
|
||||
return extensionTypeFromDesc(d)
|
||||
}
|
||||
|
||||
|
@ -9,16 +9,16 @@ import (
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
papi "github.com/golang/protobuf/protoapi"
|
||||
ptag "github.com/golang/protobuf/v2/internal/encoding/tag"
|
||||
pimpl "github.com/golang/protobuf/v2/internal/impl"
|
||||
ptype "github.com/golang/protobuf/v2/internal/prototype"
|
||||
pfmt "github.com/golang/protobuf/v2/internal/typefmt"
|
||||
pvalue "github.com/golang/protobuf/v2/internal/value"
|
||||
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
piface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
)
|
||||
|
||||
// extensionDescKey is a comparable version of protoapi.ExtensionDesc
|
||||
// extensionDescKey is a comparable version of protoiface.ExtensionDescV1
|
||||
// suitable for use as a key in a map.
|
||||
type extensionDescKey struct {
|
||||
typeV2 pref.ExtensionType
|
||||
@ -30,7 +30,7 @@ type extensionDescKey struct {
|
||||
filename string
|
||||
}
|
||||
|
||||
func extensionDescKeyOf(d *papi.ExtensionDesc) extensionDescKey {
|
||||
func extensionDescKeyOf(d *piface.ExtensionDescV1) extensionDescKey {
|
||||
return extensionDescKey{
|
||||
d.Type,
|
||||
reflect.TypeOf(d.ExtendedType),
|
||||
@ -41,14 +41,16 @@ func extensionDescKeyOf(d *papi.ExtensionDesc) extensionDescKey {
|
||||
|
||||
var (
|
||||
extensionTypeCache sync.Map // map[extensionDescKey]protoreflect.ExtensionType
|
||||
extensionDescCache sync.Map // map[protoreflect.ExtensionType]*protoapi.ExtensionDesc
|
||||
extensionDescCache sync.Map // map[protoreflect.ExtensionType]*protoiface.ExtensionDescV1
|
||||
)
|
||||
|
||||
// extensionDescFromType converts a v2 protoreflect.ExtensionType to a
|
||||
// v1 protoapi.ExtensionDesc. The returned ExtensionDesc must not be mutated.
|
||||
func extensionDescFromType(t pref.ExtensionType) *papi.ExtensionDesc {
|
||||
// protoiface.ExtensionDescV1. The returned ExtensionDesc must not be mutated.
|
||||
func extensionDescFromType(t pref.ExtensionType) *piface.ExtensionDescV1 {
|
||||
// Fast-path: check whether an extension desc is already nested within.
|
||||
if t, ok := t.(interface{ ProtoLegacyExtensionDesc() *papi.ExtensionDesc }); ok {
|
||||
if t, ok := t.(interface {
|
||||
ProtoLegacyExtensionDesc() *piface.ExtensionDescV1
|
||||
}); ok {
|
||||
if d := t.ProtoLegacyExtensionDesc(); d != nil {
|
||||
return d
|
||||
}
|
||||
@ -57,11 +59,11 @@ func extensionDescFromType(t pref.ExtensionType) *papi.ExtensionDesc {
|
||||
// Fast-path: check the cache for whether this ExtensionType has already
|
||||
// been converted to a legacy descriptor.
|
||||
if d, ok := extensionDescCache.Load(t); ok {
|
||||
return d.(*papi.ExtensionDesc)
|
||||
return d.(*piface.ExtensionDescV1)
|
||||
}
|
||||
|
||||
// Determine the parent type if possible.
|
||||
var parent papi.Message
|
||||
var parent piface.MessageV1
|
||||
if mt, ok := t.ExtendedType().(pref.MessageType); ok {
|
||||
// Create a new parent message and unwrap it if possible.
|
||||
mv := mt.New().Interface()
|
||||
@ -72,7 +74,7 @@ func extensionDescFromType(t pref.ExtensionType) *papi.ExtensionDesc {
|
||||
|
||||
// Check whether the message implements the legacy v1 Message interface.
|
||||
mz := reflect.Zero(t).Interface()
|
||||
if mz, ok := mz.(papi.Message); ok {
|
||||
if mz, ok := mz.(piface.MessageV1); ok {
|
||||
parent = mz
|
||||
}
|
||||
}
|
||||
@ -124,8 +126,8 @@ func extensionDescFromType(t pref.ExtensionType) *papi.ExtensionDesc {
|
||||
filename = fd.Path()
|
||||
}
|
||||
|
||||
// Construct and return a v1 ExtensionDesc.
|
||||
d := &papi.ExtensionDesc{
|
||||
// Construct and return a ExtensionDescV1.
|
||||
d := &piface.ExtensionDescV1{
|
||||
Type: t,
|
||||
ExtendedType: parent,
|
||||
ExtensionType: reflect.Zero(extType).Interface(),
|
||||
@ -135,16 +137,16 @@ func extensionDescFromType(t pref.ExtensionType) *papi.ExtensionDesc {
|
||||
Filename: filename,
|
||||
}
|
||||
if d, ok := extensionDescCache.LoadOrStore(t, d); ok {
|
||||
return d.(*papi.ExtensionDesc)
|
||||
return d.(*piface.ExtensionDescV1)
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
// extensionTypeFromDesc converts a v1 protoapi.ExtensionDesc to a
|
||||
// extensionTypeFromDesc converts a protoiface.ExtensionDescV1 to a
|
||||
// v2 protoreflect.ExtensionType. The returned descriptor type takes ownership
|
||||
// of the input extension desc. The input must not be mutated so long as the
|
||||
// returned type is still in use.
|
||||
func extensionTypeFromDesc(d *papi.ExtensionDesc) pref.ExtensionType {
|
||||
func extensionTypeFromDesc(d *piface.ExtensionDescV1) pref.ExtensionType {
|
||||
// Fast-path: check whether an extension type is already nested within.
|
||||
if d.Type != nil {
|
||||
return d.Type
|
||||
|
@ -7,10 +7,10 @@ package legacy_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
papi "github.com/golang/protobuf/protoapi"
|
||||
pimpl "github.com/golang/protobuf/v2/internal/impl"
|
||||
ptype "github.com/golang/protobuf/v2/internal/prototype"
|
||||
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
piface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
|
||||
// The legacy package must be imported prior to use of any legacy messages.
|
||||
// TODO: Remove this when protoV1 registers these hooks for you.
|
||||
@ -20,15 +20,15 @@ import (
|
||||
)
|
||||
|
||||
type legacyTestMessage struct {
|
||||
XXX_unrecognized []byte
|
||||
papi.XXX_InternalExtensions
|
||||
XXX_unrecognized []byte
|
||||
XXX_InternalExtensions pimpl.ExtensionFieldsV1
|
||||
}
|
||||
|
||||
func (*legacyTestMessage) Reset() {}
|
||||
func (*legacyTestMessage) String() string { return "" }
|
||||
func (*legacyTestMessage) ProtoMessage() {}
|
||||
func (*legacyTestMessage) ExtensionRangeArray() []papi.ExtensionRange {
|
||||
return []papi.ExtensionRange{{Start: 10000, End: 20000}}
|
||||
func (*legacyTestMessage) ExtensionRangeArray() []piface.ExtensionRangeV1 {
|
||||
return []piface.ExtensionRangeV1{{Start: 10000, End: 20000}}
|
||||
}
|
||||
|
||||
func mustMakeExtensionType(x *ptype.StandaloneExtension, v interface{}) pref.ExtensionType {
|
||||
@ -51,7 +51,7 @@ var (
|
||||
MessageType: messageV1Type,
|
||||
ExtendedType: parentType,
|
||||
}, (*proto2_20180125.Message_ChildMessage)(nil))
|
||||
wantDesc = &papi.ExtensionDesc{
|
||||
wantDesc = &piface.ExtensionDescV1{
|
||||
ExtendedType: (*legacyTestMessage)(nil),
|
||||
ExtensionType: (*proto2_20180125.Message_ChildMessage)(nil),
|
||||
Field: 10007,
|
||||
|
@ -6,10 +6,11 @@ package test
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
|
||||
)
|
||||
|
||||
var xxx_File_test_ext_proto_extDescs = []proto.ExtensionDesc{
|
||||
var xxx_File_test_ext_proto_extDescs = []protoiface.ExtensionDescV1{
|
||||
{
|
||||
ExtendedType: (*TestAllExtensions)(nil),
|
||||
ExtensionType: (*int32)(nil),
|
||||
|
@ -6,6 +6,7 @@ package test
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
@ -1213,10 +1214,10 @@ func (m *TestReservedFields) XXX_DiscardUnknown() {
|
||||
var xxx_messageInfo_TestReservedFields proto.InternalMessageInfo
|
||||
|
||||
type TestAllExtensions struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TestAllExtensions) ProtoReflect() protoreflect.Message {
|
||||
@ -1231,12 +1232,12 @@ func (*TestAllExtensions) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_test_test_proto_rawdesc_gzipped, []int{4}
|
||||
}
|
||||
|
||||
var extRange_TestAllExtensions = []proto.ExtensionRange{
|
||||
var extRange_TestAllExtensions = []protoiface.ExtensionRangeV1{
|
||||
{Start: 1, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use TestAllExtensions.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*TestAllExtensions) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
func (*TestAllExtensions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_TestAllExtensions
|
||||
}
|
||||
|
||||
@ -1595,7 +1596,7 @@ func (m *TestAllTypes_RepeatedGroup) GetA() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
var xxx_File_test_test_proto_extDescs = []proto.ExtensionDesc{
|
||||
var xxx_File_test_test_proto_extDescs = []protoiface.ExtensionDescV1{
|
||||
{
|
||||
ExtendedType: (*TestAllExtensions)(nil),
|
||||
ExtensionType: (*int32)(nil),
|
||||
|
@ -10,8 +10,8 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
papi "github.com/golang/protobuf/protoapi"
|
||||
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
piface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
)
|
||||
|
||||
// Unwrapper unwraps the value to the underlying value.
|
||||
@ -32,7 +32,7 @@ var (
|
||||
bytesType = reflect.TypeOf([]byte(nil))
|
||||
|
||||
enumIfaceV2 = reflect.TypeOf((*pref.Enum)(nil)).Elem()
|
||||
messageIfaceV1 = reflect.TypeOf((*papi.Message)(nil)).Elem()
|
||||
messageIfaceV1 = reflect.TypeOf((*piface.MessageV1)(nil)).Elem()
|
||||
messageIfaceV2 = reflect.TypeOf((*pref.ProtoMessage)(nil)).Elem()
|
||||
|
||||
byteType = reflect.TypeOf(byte(0))
|
||||
@ -62,9 +62,10 @@ type (
|
||||
|
||||
ExtensionTypeOf(pref.ExtensionDescriptor, interface{}) pref.ExtensionType
|
||||
|
||||
// TODO: Remove these eventually. See the TODOs in protoapi.
|
||||
ExtensionDescFromType(pref.ExtensionType) *papi.ExtensionDesc
|
||||
ExtensionTypeFromDesc(*papi.ExtensionDesc) pref.ExtensionType
|
||||
// TODO: Remove these eventually.
|
||||
// See the TODOs in internal/impl/legacy_extension.go.
|
||||
ExtensionDescFromType(pref.ExtensionType) *piface.ExtensionDescV1
|
||||
ExtensionTypeFromDesc(*piface.ExtensionDescV1) pref.ExtensionType
|
||||
}
|
||||
|
||||
LegacyEnum = interface {
|
||||
|
@ -12,11 +12,11 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
|
||||
"github.com/golang/protobuf/protoapi"
|
||||
"github.com/golang/protobuf/v2/internal/legacy"
|
||||
ptype "github.com/golang/protobuf/v2/internal/prototype"
|
||||
pref "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
preg "github.com/golang/protobuf/v2/reflect/protoregistry"
|
||||
piface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
|
||||
testpb "github.com/golang/protobuf/v2/reflect/protoregistry/testprotos"
|
||||
)
|
||||
@ -317,7 +317,7 @@ func TestFiles(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func extensionType(xd *protoapi.ExtensionDesc) pref.ExtensionType {
|
||||
func extensionType(xd *piface.ExtensionDescV1) pref.ExtensionType {
|
||||
return legacy.Export{}.ExtensionTypeFromDesc(xd)
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ package testprotos
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
@ -149,10 +150,10 @@ func (Enum3) EnumDescriptor() ([]byte, []int) {
|
||||
}
|
||||
|
||||
type Message1 struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
proto.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Message1) ProtoReflect() protoreflect.Message {
|
||||
@ -167,12 +168,12 @@ func (*Message1) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_test_proto_rawdesc_gzipped, []int{0}
|
||||
}
|
||||
|
||||
var extRange_Message1 = []proto.ExtensionRange{
|
||||
var extRange_Message1 = []protoiface.ExtensionRangeV1{
|
||||
{Start: 10, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use Message1.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*Message1) ExtensionRangeArray() []proto.ExtensionRange {
|
||||
func (*Message1) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_Message1
|
||||
}
|
||||
|
||||
@ -310,7 +311,7 @@ func (m *Message4) GetBoolField() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
var xxx_File_test_proto_extDescs = []proto.ExtensionDesc{
|
||||
var xxx_File_test_proto_extDescs = []protoiface.ExtensionDescV1{
|
||||
{
|
||||
ExtendedType: (*Message1)(nil),
|
||||
ExtensionType: (*string)(nil),
|
||||
|
71
runtime/protoiface/legacy.go
Normal file
71
runtime/protoiface/legacy.go
Normal file
@ -0,0 +1,71 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package protoiface contains types referenced by generated messages.
|
||||
//
|
||||
// WARNING: This package should only ever be imported by generated messages.
|
||||
// The compatibility agreement covers nothing except for functionality needed
|
||||
// to keep existing generated messages operational.
|
||||
package protoiface
|
||||
|
||||
import (
|
||||
"github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
)
|
||||
|
||||
type MessageV1 interface {
|
||||
Reset()
|
||||
String() string
|
||||
ProtoMessage()
|
||||
}
|
||||
|
||||
type ExtensionRangeV1 struct {
|
||||
Start, End int32 // both inclusive
|
||||
}
|
||||
|
||||
type ExtensionDescV1 struct {
|
||||
// Type is the descriptor type for the extension field using the v2 API.
|
||||
// If populated, the information in this field takes precedence over
|
||||
// all other fields in ExtensionDescV1.
|
||||
Type protoreflect.ExtensionType
|
||||
|
||||
// ExtendedType is a typed nil-pointer to the parent message type that
|
||||
// is being extended. It is possible for this to be unpopulated in v2
|
||||
// since the message may no longer implement the MessageV1 interface.
|
||||
//
|
||||
// Deprecated: Use Type.ExtendedType instead.
|
||||
ExtendedType MessageV1
|
||||
|
||||
// ExtensionType is zero value of the extension type.
|
||||
//
|
||||
// For historical reasons, reflect.TypeOf(ExtensionType) and Type.GoType
|
||||
// may not be identical:
|
||||
// * for scalars (except []byte), where ExtensionType uses *T,
|
||||
// while Type.GoType uses T.
|
||||
// * for repeated fields, where ExtensionType uses []T,
|
||||
// while Type.GoType uses *[]T.
|
||||
//
|
||||
// Deprecated: Use Type.GoType instead.
|
||||
ExtensionType interface{}
|
||||
|
||||
// Field is the field number of the extension.
|
||||
//
|
||||
// Deprecated: Use Type.Number instead.
|
||||
Field int32 // field number
|
||||
|
||||
// Name is the fully qualified name of extension.
|
||||
//
|
||||
// Deprecated: Use Type.FullName instead.
|
||||
Name string
|
||||
|
||||
// Tag is the protobuf struct tag used in the v1 API.
|
||||
//
|
||||
// Deprecated: Do not use.
|
||||
Tag string
|
||||
|
||||
// Filename is the proto filename in which the extension is defined.
|
||||
//
|
||||
// Deprecated: Use Type.Parent to ascend to the top-most parent and use
|
||||
// protoreflect.FileDescriptor.Path.
|
||||
Filename string
|
||||
}
|
@ -40,4 +40,7 @@ type (
|
||||
|
||||
MessageType = impl.MessageType
|
||||
FileBuilder = fileinit.FileBuilder
|
||||
|
||||
ExtensionFieldV1 = impl.ExtensionFieldV1
|
||||
ExtensionFieldsV1 = impl.ExtensionFieldsV1
|
||||
)
|
||||
|
@ -4,10 +4,10 @@
|
||||
package descriptor_proto
|
||||
|
||||
import (
|
||||
protoapi "github.com/golang/protobuf/protoapi"
|
||||
prototype "github.com/golang/protobuf/v2/internal/prototype"
|
||||
protoreflect "github.com/golang/protobuf/v2/reflect/protoreflect"
|
||||
protoregistry "github.com/golang/protobuf/v2/reflect/protoregistry"
|
||||
protoiface "github.com/golang/protobuf/v2/runtime/protoiface"
|
||||
protoimpl "github.com/golang/protobuf/v2/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
@ -647,11 +647,11 @@ func (m *DescriptorProto) GetReservedName() []string {
|
||||
|
||||
type ExtensionRangeOptions struct {
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
protoapi.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ExtensionRangeOptions) ProtoReflect() protoreflect.Message {
|
||||
@ -666,12 +666,12 @@ func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{3}
|
||||
}
|
||||
|
||||
var extRange_ExtensionRangeOptions = []protoapi.ExtensionRange{
|
||||
var extRange_ExtensionRangeOptions = []protoiface.ExtensionRangeV1{
|
||||
{Start: 1000, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use ExtensionRangeOptions.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*ExtensionRangeOptions) ExtensionRangeArray() []protoapi.ExtensionRange {
|
||||
func (*ExtensionRangeOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_ExtensionRangeOptions
|
||||
}
|
||||
|
||||
@ -1144,11 +1144,11 @@ type FileOptions struct {
|
||||
RubyPackage *string `protobuf:"bytes,45,opt,name=ruby_package,json=rubyPackage" json:"ruby_package,omitempty"`
|
||||
// The parser stores options it doesn't recognize here.
|
||||
// See the documentation for the "Options" section above.
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
protoapi.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *FileOptions) ProtoReflect() protoreflect.Message {
|
||||
@ -1163,12 +1163,12 @@ func (*FileOptions) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{10}
|
||||
}
|
||||
|
||||
var extRange_FileOptions = []protoapi.ExtensionRange{
|
||||
var extRange_FileOptions = []protoiface.ExtensionRangeV1{
|
||||
{Start: 1000, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use FileOptions.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*FileOptions) ExtensionRangeArray() []protoapi.ExtensionRange {
|
||||
func (*FileOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_FileOptions
|
||||
}
|
||||
|
||||
@ -1382,11 +1382,11 @@ type MessageOptions struct {
|
||||
// parser.
|
||||
MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"`
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
protoapi.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MessageOptions) ProtoReflect() protoreflect.Message {
|
||||
@ -1401,12 +1401,12 @@ func (*MessageOptions) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{11}
|
||||
}
|
||||
|
||||
var extRange_MessageOptions = []protoapi.ExtensionRange{
|
||||
var extRange_MessageOptions = []protoiface.ExtensionRangeV1{
|
||||
{Start: 1000, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use MessageOptions.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*MessageOptions) ExtensionRangeArray() []protoapi.ExtensionRange {
|
||||
func (*MessageOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_MessageOptions
|
||||
}
|
||||
|
||||
@ -1510,11 +1510,11 @@ type FieldOptions struct {
|
||||
// For Google-internal migration only. Do not use.
|
||||
Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"`
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
protoapi.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *FieldOptions) ProtoReflect() protoreflect.Message {
|
||||
@ -1529,12 +1529,12 @@ func (*FieldOptions) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{12}
|
||||
}
|
||||
|
||||
var extRange_FieldOptions = []protoapi.ExtensionRange{
|
||||
var extRange_FieldOptions = []protoiface.ExtensionRangeV1{
|
||||
{Start: 1000, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use FieldOptions.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*FieldOptions) ExtensionRangeArray() []protoapi.ExtensionRange {
|
||||
func (*FieldOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_FieldOptions
|
||||
}
|
||||
|
||||
@ -1595,11 +1595,11 @@ func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption {
|
||||
|
||||
type OneofOptions struct {
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
protoapi.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OneofOptions) ProtoReflect() protoreflect.Message {
|
||||
@ -1614,12 +1614,12 @@ func (*OneofOptions) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{13}
|
||||
}
|
||||
|
||||
var extRange_OneofOptions = []protoapi.ExtensionRange{
|
||||
var extRange_OneofOptions = []protoiface.ExtensionRangeV1{
|
||||
{Start: 1000, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use OneofOptions.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*OneofOptions) ExtensionRangeArray() []protoapi.ExtensionRange {
|
||||
func (*OneofOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_OneofOptions
|
||||
}
|
||||
|
||||
@ -1640,11 +1640,11 @@ type EnumOptions struct {
|
||||
// is a formalization for deprecating enums.
|
||||
Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"`
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
protoapi.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *EnumOptions) ProtoReflect() protoreflect.Message {
|
||||
@ -1659,12 +1659,12 @@ func (*EnumOptions) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{14}
|
||||
}
|
||||
|
||||
var extRange_EnumOptions = []protoapi.ExtensionRange{
|
||||
var extRange_EnumOptions = []protoiface.ExtensionRangeV1{
|
||||
{Start: 1000, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use EnumOptions.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*EnumOptions) ExtensionRangeArray() []protoapi.ExtensionRange {
|
||||
func (*EnumOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_EnumOptions
|
||||
}
|
||||
|
||||
@ -1698,11 +1698,11 @@ type EnumValueOptions struct {
|
||||
// this is a formalization for deprecating enum values.
|
||||
Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"`
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
protoapi.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *EnumValueOptions) ProtoReflect() protoreflect.Message {
|
||||
@ -1717,12 +1717,12 @@ func (*EnumValueOptions) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{15}
|
||||
}
|
||||
|
||||
var extRange_EnumValueOptions = []protoapi.ExtensionRange{
|
||||
var extRange_EnumValueOptions = []protoiface.ExtensionRangeV1{
|
||||
{Start: 1000, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use EnumValueOptions.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*EnumValueOptions) ExtensionRangeArray() []protoapi.ExtensionRange {
|
||||
func (*EnumValueOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_EnumValueOptions
|
||||
}
|
||||
|
||||
@ -1749,11 +1749,11 @@ type ServiceOptions struct {
|
||||
// this is a formalization for deprecating services.
|
||||
Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"`
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
protoapi.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ServiceOptions) ProtoReflect() protoreflect.Message {
|
||||
@ -1768,12 +1768,12 @@ func (*ServiceOptions) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{16}
|
||||
}
|
||||
|
||||
var extRange_ServiceOptions = []protoapi.ExtensionRange{
|
||||
var extRange_ServiceOptions = []protoiface.ExtensionRangeV1{
|
||||
{Start: 1000, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use ServiceOptions.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*ServiceOptions) ExtensionRangeArray() []protoapi.ExtensionRange {
|
||||
func (*ServiceOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_ServiceOptions
|
||||
}
|
||||
|
||||
@ -1801,11 +1801,11 @@ type MethodOptions struct {
|
||||
Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"`
|
||||
IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"`
|
||||
// The parser stores options it doesn't recognize here. See above.
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
protoapi.XXX_InternalExtensions `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_InternalExtensions protoimpl.ExtensionFieldsV1 `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MethodOptions) ProtoReflect() protoreflect.Message {
|
||||
@ -1820,12 +1820,12 @@ func (*MethodOptions) Descriptor() ([]byte, []int) {
|
||||
return xxx_File_google_protobuf_descriptor_proto_rawdesc_gzipped, []int{17}
|
||||
}
|
||||
|
||||
var extRange_MethodOptions = []protoapi.ExtensionRange{
|
||||
var extRange_MethodOptions = []protoiface.ExtensionRangeV1{
|
||||
{Start: 1000, End: 536870911},
|
||||
}
|
||||
|
||||
// Deprecated: Use MethodOptions.ProtoReflect.Type.ExtensionRanges instead.
|
||||
func (*MethodOptions) ExtensionRangeArray() []protoapi.ExtensionRange {
|
||||
func (*MethodOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 {
|
||||
return extRange_MethodOptions
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user