mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-02-20 15:41:07 +00:00
reflect/protoreflect: remove methods with Type suffix
CL/172238 added equivalent methods without the Type suffix, while keeping the old methods. CL/172582 updates the v1 codebase to use the new methods. This CL removes the methods with the Type suffix. Change-Id: Iaaaa4fff11cac1694735657db2e5fd7cadc90afe Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/173138 Reviewed-by: Herbie Ong <herbie@google.com>
This commit is contained in:
parent
d24bc72368
commit
c90b6ada23
2
cmd/protoc-gen-go-grpc/testdata/go.mod
vendored
2
cmd/protoc-gen-go-grpc/testdata/go.mod
vendored
@ -1,7 +1,7 @@
|
||||
module github.com/golang/protobuf/v2/cmd/protoc-gen-go-grpc/testdata
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.2.1-0.20190416233244-13cf6e79fd39
|
||||
github.com/golang/protobuf v1.2.1-0.20190420064300-2b4f3c98b458
|
||||
github.com/golang/protobuf/v2 v2.0.0
|
||||
google.golang.org/grpc v1.19.0
|
||||
)
|
||||
|
2
cmd/protoc-gen-go/testdata/go.mod
vendored
2
cmd/protoc-gen-go/testdata/go.mod
vendored
@ -1,7 +1,7 @@
|
||||
module github.com/golang/protobuf/v2/cmd/protoc-gen-go/testdata
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.2.1-0.20190416233244-13cf6e79fd39
|
||||
github.com/golang/protobuf v1.2.1-0.20190420064300-2b4f3c98b458
|
||||
github.com/golang/protobuf/v2 v2.0.0
|
||||
)
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
||||
module github.com/golang/protobuf/v2
|
||||
|
||||
require (
|
||||
github.com/golang/protobuf v1.2.1-0.20190416233244-13cf6e79fd39
|
||||
github.com/golang/protobuf v1.2.1-0.20190420064300-2b4f3c98b458
|
||||
github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42
|
||||
)
|
||||
|
4
go.sum
4
go.sum
@ -1,8 +1,10 @@
|
||||
github.com/golang/protobuf v1.2.1-0.20190322195920-d94fb84e04b7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.2.1-0.20190326022002-be03c15fcaa2/go.mod h1:rZ4veVXHB1S2+o7TKqD9Isxml062IeDutnCDtFPUlCc=
|
||||
github.com/golang/protobuf v1.2.1-0.20190416233244-13cf6e79fd39 h1:5ypd1txfe3cmWAw+lhzJXDrjc8gyh6/3KkhnPSfkrUQ=
|
||||
github.com/golang/protobuf v1.2.1-0.20190416233244-13cf6e79fd39/go.mod h1:RgnTNLHWo9HXezTFX5MTeuXnXx9eeQX8y3Cukv+9HaE=
|
||||
github.com/golang/protobuf v1.2.1-0.20190420064300-2b4f3c98b458 h1:vQpM9R/v2X3bLjRvDKfw215cmiOx0OZ5Y4SCxgmp7m4=
|
||||
github.com/golang/protobuf v1.2.1-0.20190420064300-2b4f3c98b458/go.mod h1:hPB+itxf2EbA0J6prVtJg+ohMeLFLEhlSXXPS2qxTZE=
|
||||
github.com/golang/protobuf/v2 v2.0.0-20190322201422-f503c300f70e/go.mod h1:25ZALhydMFaBRgPH58a8zpFe9YXMAMjOYWtB6pNPcoo=
|
||||
github.com/golang/protobuf/v2 v2.0.0-20190416222953-ab61d41ec93f/go.mod h1:baUT2weUsA1MR7ocRtLXLmi2B1s4VrUT3S6tO8AYzMw=
|
||||
github.com/golang/protobuf/v2 v2.0.0-20190420063524-d24bc72368a2/go.mod h1:wcEMLTNPNYxBFS3yY7kunR0QKUgP/f+wzZaPeTbHi0g=
|
||||
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=
|
||||
|
@ -446,12 +446,6 @@ func (fd *fieldDesc) Message() pref.MessageDescriptor { return fd.mes
|
||||
func (fd *fieldDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, fd) }
|
||||
func (fd *fieldDesc) ProtoType(pref.FieldDescriptor) {}
|
||||
|
||||
// TODO: Remove these methods.
|
||||
func (fd *fieldDesc) OneofType() pref.OneofDescriptor { return fd.Oneof() }
|
||||
func (fd *fieldDesc) ExtendedType() pref.MessageDescriptor { return fd.Extendee() }
|
||||
func (fd *fieldDesc) EnumType() pref.EnumDescriptor { return fd.Enum() }
|
||||
func (fd *fieldDesc) MessageType() pref.MessageDescriptor { return fd.Message() }
|
||||
|
||||
func (od *oneofDesc) Options() pref.ProtoMessage {
|
||||
return unmarshalOptions(descopts.Oneof, od.options)
|
||||
}
|
||||
@ -533,12 +527,6 @@ func (xd *extensionDesc) ProtoLegacyExtensionDesc() *piface.ExtensionDescV1 {
|
||||
return xd.legacyDesc
|
||||
}
|
||||
|
||||
// TODO: Remove these methods.
|
||||
func (xd *extensionDesc) OneofType() pref.OneofDescriptor { return xd.Oneof() }
|
||||
func (xd *extensionDesc) ExtendedType() pref.MessageDescriptor { return xd.Extendee() }
|
||||
func (xd *extensionDesc) EnumType() pref.EnumDescriptor { return xd.Enum() }
|
||||
func (xd *extensionDesc) MessageType() pref.MessageDescriptor { return xd.Message() }
|
||||
|
||||
type (
|
||||
serviceDesc struct {
|
||||
baseDesc
|
||||
@ -583,10 +571,6 @@ func (md *methodDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s,
|
||||
func (md *methodDesc) ProtoType(pref.MethodDescriptor) {}
|
||||
func (md *methodDesc) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
// TODO: Remove these methods.
|
||||
func (md *methodDesc) InputType() pref.MessageDescriptor { return md.Input() }
|
||||
func (md *methodDesc) OutputType() pref.MessageDescriptor { return md.Output() }
|
||||
|
||||
type baseDesc struct {
|
||||
parentFile *fileDesc
|
||||
parent pref.Descriptor
|
||||
|
@ -778,12 +778,6 @@ func TestExtensionConvert(t *testing.T) {
|
||||
if !v.IsNil() {
|
||||
out[name] = v.Interface().(pref.Descriptor).FullName()
|
||||
}
|
||||
// TODO: Remove this when the methods are deleted.
|
||||
case "OneofType", "ExtendedType", "EnumType", "MessageType":
|
||||
v := m.Call(nil)[0]
|
||||
if !v.IsNil() {
|
||||
out[name] = v.Interface().(pref.Descriptor).FullName()
|
||||
}
|
||||
default:
|
||||
out[name] = m.Call(nil)[0].Interface()
|
||||
}
|
||||
|
@ -440,12 +440,6 @@ func TestDescriptor(t *testing.T) {
|
||||
if !v.IsNil() {
|
||||
out[name] = v.Interface().(pref.Descriptor).FullName()
|
||||
}
|
||||
// TODO: Remove this when the methods are deleted.
|
||||
case "OneofType", "ExtendedType", "EnumType", "MessageType":
|
||||
v := m.Call(nil)[0]
|
||||
if !v.IsNil() {
|
||||
out[name] = v.Interface().(pref.Descriptor).FullName()
|
||||
}
|
||||
default:
|
||||
out[name] = m.Call(nil)[0].Interface()
|
||||
}
|
||||
|
@ -174,12 +174,6 @@ func (t fieldDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc
|
||||
func (t fieldDesc) ProtoType(pref.FieldDescriptor) {}
|
||||
func (t fieldDesc) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
// TODO: Remove these methods.
|
||||
func (t fieldDesc) OneofType() pref.OneofDescriptor { return t.Oneof() }
|
||||
func (t fieldDesc) ExtendedType() pref.MessageDescriptor { return t.Extendee() }
|
||||
func (t fieldDesc) EnumType() pref.EnumDescriptor { return t.Enum() }
|
||||
func (t fieldDesc) MessageType() pref.MessageDescriptor { return t.Message() }
|
||||
|
||||
func isPacked(packed OptionalBool, s pref.Syntax, c pref.Cardinality, k pref.Kind) bool {
|
||||
if packed == False || (packed == DefaultBool && s == pref.Proto2) {
|
||||
return false
|
||||
@ -303,12 +297,6 @@ func (t extensionDesc) Format(s fmt.State, r rune) { pfmt.Format
|
||||
func (t extensionDesc) ProtoType(pref.FieldDescriptor) {}
|
||||
func (t extensionDesc) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
// TODO: Remove these methods.
|
||||
func (t extensionDesc) OneofType() pref.OneofDescriptor { return t.Oneof() }
|
||||
func (t extensionDesc) ExtendedType() pref.MessageDescriptor { return t.Extendee() }
|
||||
func (t extensionDesc) EnumType() pref.EnumDescriptor { return t.Enum() }
|
||||
func (t extensionDesc) MessageType() pref.MessageDescriptor { return t.Message() }
|
||||
|
||||
type enumMeta struct {
|
||||
inheritedMeta
|
||||
|
||||
@ -393,10 +381,6 @@ func (t methodDesc) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r,
|
||||
func (t methodDesc) ProtoType(pref.MethodDescriptor) {}
|
||||
func (t methodDesc) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
// TODO: Remove these methods.
|
||||
func (t methodDesc) InputType() pref.MessageDescriptor { return t.Input() }
|
||||
func (t methodDesc) OutputType() pref.MessageDescriptor { return t.Output() }
|
||||
|
||||
type defaultValue struct {
|
||||
once sync.Once
|
||||
val pref.Value
|
||||
|
@ -96,9 +96,3 @@ func (t standaloneExtension) Message() pref.MessageDescriptor { return t.x.M
|
||||
func (t standaloneExtension) Format(s fmt.State, r rune) { pfmt.FormatDesc(s, r, t) }
|
||||
func (t standaloneExtension) ProtoType(pref.FieldDescriptor) {}
|
||||
func (t standaloneExtension) ProtoInternal(pragma.DoNotImplement) {}
|
||||
|
||||
// TODO: Remove these methods.
|
||||
func (t standaloneExtension) OneofType() pref.OneofDescriptor { return t.Oneof() }
|
||||
func (t standaloneExtension) ExtendedType() pref.MessageDescriptor { return t.Extendee() }
|
||||
func (t standaloneExtension) EnumType() pref.EnumDescriptor { return t.Enum() }
|
||||
func (t standaloneExtension) MessageType() pref.MessageDescriptor { return t.Message() }
|
||||
|
@ -27,14 +27,6 @@ func TestDescriptorAccessors(t *testing.T) {
|
||||
"DescriptorProto": true,
|
||||
"ExtensionRangeOptions": true,
|
||||
"Options": true,
|
||||
|
||||
// TODO: Remove these when the methods are removed.
|
||||
"OneofType": true,
|
||||
"ExtendedType": true,
|
||||
"EnumType": true,
|
||||
"MessageType": true,
|
||||
"InputType": true,
|
||||
"OutputType": true,
|
||||
}
|
||||
|
||||
for rt, m := range descriptorAccessors {
|
||||
|
@ -318,19 +318,6 @@ type FieldDescriptor interface {
|
||||
// MessageKind or GroupKind. It returns nil for any other Kind.
|
||||
Message() MessageDescriptor
|
||||
|
||||
// OneofType has been renamed to Oneof.
|
||||
// Deprecated: Use Oneof instead; this will be removed.
|
||||
OneofType() OneofDescriptor
|
||||
// ExtendedType has been renamed to Extendee.
|
||||
// Deprecated: Use Extendee instead; this will be removed.
|
||||
ExtendedType() MessageDescriptor
|
||||
// EnumType has been renamed to Enum.
|
||||
// Deprecated: Use Enum instead; this will be removed.
|
||||
EnumType() EnumDescriptor
|
||||
// MessageType has been renamed to Message.
|
||||
// Deprecated: Use Message instead; this will be removed.
|
||||
MessageType() MessageDescriptor
|
||||
|
||||
isFieldDescriptor
|
||||
}
|
||||
type isFieldDescriptor interface{ ProtoType(FieldDescriptor) }
|
||||
@ -572,13 +559,6 @@ type MethodDescriptor interface {
|
||||
// IsStreamingServer reports whether the server streams multiple messages.
|
||||
IsStreamingServer() bool
|
||||
|
||||
// InputType has been renamed to Input.
|
||||
// Deprecated: Use Input instead; this will be removed.
|
||||
InputType() MessageDescriptor
|
||||
// OutputType has been renamed to Output.
|
||||
// Deprecated: Use Output instead; this will be removed.
|
||||
OutputType() MessageDescriptor
|
||||
|
||||
isMethodDescriptor
|
||||
}
|
||||
type isMethodDescriptor interface{ ProtoType(MethodDescriptor) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user