Forráskód Böngészése

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>
Joe Tsai 6 éve
szülő
commit
01887a85f5

+ 0 - 4
internal/descfmt/desc_test.go

@@ -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,

+ 0 - 8
internal/fileinit/desc.go

@@ -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

+ 0 - 2
internal/impl/legacy_file_test.go

@@ -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()
 					}

+ 0 - 2
internal/impl/legacy_test.go

@@ -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()
 							}

+ 0 - 8
internal/prototype/protofile_type.go

@@ -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
 

+ 0 - 4
internal/prototype/standalone_type.go

@@ -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 }

+ 0 - 7
reflect/protoreflect/type.go

@@ -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