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>
diff --git a/cmd/protoc-gen-go-grpc/testdata/go.mod b/cmd/protoc-gen-go-grpc/testdata/go.mod
index 6785682..5d51ecd 100644
--- a/cmd/protoc-gen-go-grpc/testdata/go.mod
+++ b/cmd/protoc-gen-go-grpc/testdata/go.mod
@@ -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
)
diff --git a/cmd/protoc-gen-go/testdata/go.mod b/cmd/protoc-gen-go/testdata/go.mod
index 2cf84ad..d3ca31d 100644
--- a/cmd/protoc-gen-go/testdata/go.mod
+++ b/cmd/protoc-gen-go/testdata/go.mod
@@ -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
)
diff --git a/go.mod b/go.mod
index de2dded..98e3e52 100644
--- a/go.mod
+++ b/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
)
diff --git a/go.sum b/go.sum
index 0697572..cff3a62 100644
--- a/go.sum
+++ b/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=
diff --git a/internal/fileinit/desc.go b/internal/fileinit/desc.go
index 1d1e10a..1665b30 100644
--- a/internal/fileinit/desc.go
+++ b/internal/fileinit/desc.go
@@ -446,12 +446,6 @@
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 @@
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) 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
diff --git a/internal/impl/legacy_test.go b/internal/impl/legacy_test.go
index 799289b..927d715 100644
--- a/internal/impl/legacy_test.go
+++ b/internal/impl/legacy_test.go
@@ -778,12 +778,6 @@
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()
}
diff --git a/internal/legacy/file_test.go b/internal/legacy/file_test.go
index 20e4aa2..395a2ef 100644
--- a/internal/legacy/file_test.go
+++ b/internal/legacy/file_test.go
@@ -440,12 +440,6 @@
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()
}
diff --git a/internal/prototype/protofile_type.go b/internal/prototype/protofile_type.go
index 271fdbc..49d0db1 100644
--- a/internal/prototype/protofile_type.go
+++ b/internal/prototype/protofile_type.go
@@ -174,12 +174,6 @@
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) 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) 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
diff --git a/internal/prototype/standalone_type.go b/internal/prototype/standalone_type.go
index 098e5ae..91579da 100644
--- a/internal/prototype/standalone_type.go
+++ b/internal/prototype/standalone_type.go
@@ -96,9 +96,3 @@
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() }
diff --git a/internal/typefmt/desc_test.go b/internal/typefmt/desc_test.go
index 6fe9017..346362b 100644
--- a/internal/typefmt/desc_test.go
+++ b/internal/typefmt/desc_test.go
@@ -27,14 +27,6 @@
"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 {
diff --git a/reflect/protoreflect/type.go b/reflect/protoreflect/type.go
index 6a56f43..f01b291 100644
--- a/reflect/protoreflect/type.go
+++ b/reflect/protoreflect/type.go
@@ -318,19 +318,6 @@
// 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 @@
// 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) }