reflect/protoreflect: remove FieldDescriptor.{Oneof,Extendee} methods

This is a breaking change in light of new methods added in CL/176977.

This removes:
	FieldDescriptor.Oneof: replacement is ContainingOneof
	FieldDescriptor.Extendee: replacement is IsExtension and ContainingMessage

Change-Id: I82008e46fb3b80de8e8a0ac42afc54e8c4b67411
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/176942
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Joe Tsai 2019-05-13 17:34:56 -07:00 committed by Joe Tsai
parent a93fdf5404
commit 01887a85f5
7 changed files with 0 additions and 35 deletions

View File

@ -26,10 +26,6 @@ func TestDescriptorAccessors(t *testing.T) {
"MapKey": true, // specific to FieldDescriptor
"MapValue": true, // specific to FieldDescriptor
// TODO: Remove this.
"Oneof": true, // specific to FieldDescriptor
"Extendee": true, // specific to FieldDescriptor
// TODO: These should be removed or handled.
"DescriptorProto": true,
"ExtensionRangeOptions": true,

View File

@ -465,10 +465,6 @@ func (fd *fieldDesc) Message() pref.MessageDescriptor { return fd.messageType }
func (fd *fieldDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
func (fd *fieldDesc) ProtoType(pref.FieldDescriptor) {}
// TODO: Remove this.
func (fd *fieldDesc) Oneof() pref.OneofDescriptor { return fd.oneofType }
func (fd *fieldDesc) Extendee() pref.MessageDescriptor { return nil }
func (od *oneofDesc) Options() pref.ProtoMessage {
return unmarshalOptions(descopts.Oneof, od.options)
}
@ -555,10 +551,6 @@ func (xd *extensionDesc) ProtoLegacyExtensionDesc() *piface.ExtensionDescV1 {
return xd.legacyDesc
}
// TODO: Remove this.
func (xd *extensionDesc) Oneof() pref.OneofDescriptor { return nil }
func (xd *extensionDesc) Extendee() pref.MessageDescriptor { return xd.extendedType }
type (
serviceDesc struct {
baseDesc

View File

@ -442,8 +442,6 @@ func TestDescriptor(t *testing.T) {
if !v.IsNil() {
out[name] = v.Interface().(pref.Descriptor).FullName()
}
case "Oneof", "Extendee":
// TODO: Remove this.
default:
out[name] = m.Call(nil)[0].Interface()
}

View File

@ -519,8 +519,6 @@ func TestExtensionConvert(t *testing.T) {
if !v.IsNil() {
out[name] = v.Interface().(pref.Descriptor).FullName()
}
case "Oneof", "Extendee":
// TODO: Remove this.
default:
out[name] = m.Call(nil)[0].Interface()
}

View File

@ -205,10 +205,6 @@ func (t fieldDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc(s,
func (t fieldDesc) ProtoType(pref.FieldDescriptor) {}
func (t fieldDesc) ProtoInternal(pragma.DoNotImplement) {}
// TODO: Remove this.
func (t fieldDesc) Oneof() pref.OneofDescriptor { return t.f.ot.lazyInit(t, t.f.OneofName) }
func (t fieldDesc) Extendee() pref.MessageDescriptor { return nil }
func isPacked(packed OptionalBool, s pref.Syntax, c pref.Cardinality, k pref.Kind) bool {
if packed == False || (packed == DefaultBool && s == pref.Proto2) {
return false
@ -339,10 +335,6 @@ func (t extensionDesc) Format(s fmt.State, r rune) { descfmt.FormatDesc
func (t extensionDesc) ProtoType(pref.FieldDescriptor) {}
func (t extensionDesc) ProtoInternal(pragma.DoNotImplement) {}
// TODO: Remove this.
func (t extensionDesc) Oneof() pref.OneofDescriptor { return nil }
func (t extensionDesc) Extendee() pref.MessageDescriptor { return t.x.xt.lazyInit(t, &t.x.ExtendedType) }
type enumMeta struct {
inheritedMeta

View File

@ -103,7 +103,3 @@ func (t standaloneExtension) Message() pref.MessageDescriptor { return
func (t standaloneExtension) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, t) }
func (t standaloneExtension) ProtoType(pref.FieldDescriptor) {}
func (t standaloneExtension) ProtoInternal(pragma.DoNotImplement) {}
// TODO: Remove this.
func (t standaloneExtension) Oneof() pref.OneofDescriptor { return nil }
func (t standaloneExtension) Extendee() pref.MessageDescriptor { return t.x.ExtendedType }

View File

@ -329,13 +329,6 @@ type FieldDescriptor interface {
// of an enum field, and is nil for any other kind of field.
DefaultEnumValue() EnumValueDescriptor
// TODO: Remove this.
// Deprecated: Use ContainingOneof instead.
Oneof() OneofDescriptor
// TODO: Remove this.
// Deprecated: Use ContainingMessage instead.
Extendee() MessageDescriptor
// ContainingOneof is the containing oneof that this field belongs to,
// and is nil if this field is not part of a oneof.
ContainingOneof() OneofDescriptor