internal/impl: fix legacy logic to know about the new XXX_OneofWrappers method

The XXX_OneofWrappers method is a simplified way to obtain the wrapper structs
compared the previous XXX_OneofFuncs method which returned far more information
that was strictly necessary.

Change-Id: I2670506a2a8f7e8e724846b8c4083e7995371007
Reviewed-on: https://go-review.googlesource.com/c/151679
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/internal/testprotos/legacy/legacy.pb.go b/internal/testprotos/legacy/legacy.pb.go
index b629f42..0ac4cd7 100644
--- a/internal/testprotos/legacy/legacy.pb.go
+++ b/internal/testprotos/legacy/legacy.pb.go
@@ -11,11 +11,13 @@
 	proto2_v1_0 "github.com/golang/protobuf/v2/internal/testprotos/legacy/proto2.v1.0.0-20180125-92554152"
 	proto2_v1_1 "github.com/golang/protobuf/v2/internal/testprotos/legacy/proto2.v1.1.0-20180430-b4deda09"
 	proto2_v1_2 "github.com/golang/protobuf/v2/internal/testprotos/legacy/proto2.v1.2.0-20180814-aa810b61"
+	proto2_v1_21 "github.com/golang/protobuf/v2/internal/testprotos/legacy/proto2.v1.2.1-20181126-8d0c54c1"
 	proto3_v0_0 "github.com/golang/protobuf/v2/internal/testprotos/legacy/proto3.v0.0.0-20160225-2fc053c5"
 	proto3_v0_01 "github.com/golang/protobuf/v2/internal/testprotos/legacy/proto3.v0.0.0-20160519-a4ab9ec5"
 	proto3_v1_0 "github.com/golang/protobuf/v2/internal/testprotos/legacy/proto3.v1.0.0-20180125-92554152"
 	proto3_v1_1 "github.com/golang/protobuf/v2/internal/testprotos/legacy/proto3.v1.1.0-20180430-b4deda09"
 	proto3_v1_2 "github.com/golang/protobuf/v2/internal/testprotos/legacy/proto3.v1.2.0-20180814-aa810b61"
+	proto3_v1_21 "github.com/golang/protobuf/v2/internal/testprotos/legacy/proto3.v1.2.1-20181126-8d0c54c1"
 	math "math"
 )
 
@@ -28,7 +30,7 @@
 // is compatible with the proto package it is being compiled against.
 // A compilation error at this line likely means your copy of the
 // proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
 
 type Legacy struct {
 	F1                   *proto2_v0_0.Message  `protobuf:"bytes,1,opt,name=f1,proto3" json:"f1,omitempty"`
@@ -41,6 +43,8 @@
 	F8                   *proto3_v1_1.Message  `protobuf:"bytes,8,opt,name=f8,proto3" json:"f8,omitempty"`
 	F9                   *proto2_v1_2.Message  `protobuf:"bytes,9,opt,name=f9,proto3" json:"f9,omitempty"`
 	F10                  *proto3_v1_2.Message  `protobuf:"bytes,10,opt,name=f10,proto3" json:"f10,omitempty"`
+	F11                  *proto2_v1_21.Message `protobuf:"bytes,11,opt,name=f11,proto3" json:"f11,omitempty"`
+	F12                  *proto3_v1_21.Message `protobuf:"bytes,12,opt,name=f12,proto3" json:"f12,omitempty"`
 	XXX_NoUnkeyedLiteral struct{}              `json:"-"`
 	XXX_unrecognized     []byte                `json:"-"`
 	XXX_sizecache        int32                 `json:"-"`
@@ -141,6 +145,20 @@
 	return nil
 }
 
+func (m *Legacy) GetF11() *proto2_v1_21.Message {
+	if m != nil {
+		return m.F11
+	}
+	return nil
+}
+
+func (m *Legacy) GetF12() *proto3_v1_21.Message {
+	if m != nil {
+		return m.F12
+	}
+	return nil
+}
+
 func init() {
 	proto.RegisterType((*Legacy)(nil), "google.golang.org.Legacy")
 }
@@ -150,28 +168,30 @@
 }
 
 var fileDescriptor_5fbf266527ec81d8 = []byte{
-	// 364 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0xd2, 0x3d, 0x4f, 0xf3, 0x30,
-	0x14, 0x05, 0x60, 0xf5, 0xe3, 0xed, 0x0b, 0x61, 0xa2, 0x93, 0xc5, 0x84, 0x58, 0x40, 0x48, 0x71,
-	0xec, 0x1b, 0x3b, 0x4d, 0x2a, 0x26, 0x24, 0x36, 0x58, 0x18, 0x59, 0x90, 0x93, 0x3a, 0xa6, 0x52,
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, 0x00, 0x1e, 0x9b, 0x33, 0xa4, 0x77, 0xba, 0x2c, 0x95, 0xd1, 0xf7, 0xdd, 0x9c,
-	0xa3, 0x05, 0xd2, 0x5d, 0x6f, 0xc3, 0x9f, 0x2c, 0xa0, 0x0d, 0x49, 0xcf, 0xa9, 0x57, 0xf2, 0xa4,
-	0x65, 0x43, 0xb4, 0x82, 0xf4, 0x9d, 0x7a, 0x57, 0xad, 0x40, 0x2b, 0xc9, 0x3f, 0x87, 0x5e, 0x3c,
-	0xad, 0x96, 0x95, 0x68, 0x23, 0x32, 0x70, 0xe8, 0xfd, 0x6a, 0x23, 0xb4, 0x23, 0xf2, 0xdf, 0xa9,
-	0x57, 0x84, 0xac, 0x65, 0x47, 0x68, 0x63, 0x72, 0xe0, 0xd4, 0xbb, 0x6a, 0x63, 0xb4, 0x09, 0x39,
-	0x74, 0xea, 0x8d, 0xb9, 0x68, 0xd9, 0x64, 0x78, 0xe5, 0xf5, 0x72, 0xce, 0x88, 0xe7, 0x54, 0xdc,
-	0xc6, 0x1f, 0xec, 0x7a, 0xfc, 0x10, 0x9b, 0x69, 0xf5, 0xb4, 0x48, 0x69, 0x66, 0x9f, 0x83, 0x5a,
-	0xd5, 0x47, 0x9a, 0x2e, 0xf2, 0x60, 0x09, 0xc1, 0xef, 0xb7, 0x9c, 0x0e, 0xea, 0xe4, 0xf7, 0x00,
-	0x00, 0x00, 0xff, 0xff, 0xb8, 0x31, 0xcb, 0xb1, 0xab, 0x05, 0x00, 0x00,
+	// 400 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0xd3, 0xcf, 0xce, 0xd2, 0x40,
+	0x14, 0x05, 0xf0, 0x00, 0x82, 0x5a, 0xdc, 0xc8, 0x6a, 0xe2, 0xca, 0xb8, 0xd1, 0x98, 0x74, 0x3a,
+	0xf7, 0x76, 0xa6, 0x4c, 0x89, 0x2b, 0x13, 0x77, 0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