internal/value: rename the Unwrap method as ProtoUnwrap
Add a Proto prefix before the Unwrap method to reduce the probability that
it would ever conflict with a method of the same name that a
custom implementation of Enum, Message, List, or Map may have.
Change-Id: I628bf8335583f2747ab4589f3e6ff82e4501ce98
Reviewed-on: https://go-review.googlesource.com/c/151817
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/internal/impl/legacy_extension.go b/internal/impl/legacy_extension.go
index 86d1bac..d87892f 100644
--- a/internal/impl/legacy_extension.go
+++ b/internal/impl/legacy_extension.go
@@ -318,7 +318,7 @@
// Both of those type satisfy the value.Unwrapper interface.
xt2.typ = t
xt2.new = func() interface{} {
- return xt.New().(pvalue.Unwrapper).Unwrap()
+ return xt.New().(pvalue.Unwrapper).ProtoUnwrap()
}
xt2.valueOf = func(v interface{}) pref.Value {
if reflect.TypeOf(v) != xt2.typ {
@@ -331,7 +331,7 @@
}
}
xt2.interfaceOf = func(v pref.Value) interface{} {
- return xt.InterfaceOf(v).(pvalue.Unwrapper).Unwrap()
+ return xt.InterfaceOf(v).(pvalue.Unwrapper).ProtoUnwrap()
}
} else {
// Custom extension type for repeated enums and messages.
@@ -346,7 +346,7 @@
return pref.ValueOf(pvalue.ListOf(v, conv))
}
xt2.interfaceOf = func(pv pref.Value) interface{} {
- v := pv.List().(pvalue.Unwrapper).Unwrap()
+ v := pv.List().(pvalue.Unwrapper).ProtoUnwrap()
if reflect.TypeOf(v) != xt2.typ {
panic(fmt.Sprintf("invalid type: got %T, want %v", v, xt2.typ))
}