Repository: golang/mock
Pull request #93 (2017-07-22 14:35:58)

Restore backwards compatibility for controller.RecordCall.
broken by #89


Patch:
diff --git a/gomock/controller.go b/gomock/controller.go
index 3af6424..6bff78d 100644
--- a/gomock/controller.go
+++ b/gomock/controller.go
@@ -56,6 +56,7 @@
 package gomock
 
 import (
+	"fmt"
 	"reflect"
 	"sync"
 )
@@ -83,7 +84,19 @@ func NewController(t TestReporter) *Controller {
 	}
 }
 
-func (ctrl *Controller) RecordCall(receiver interface{}, method string, methodType reflect.Type, args ...interface{}) *Call {
+func (ctrl *Controller) RecordCall(receiver interface{}, method string, args ...interface{}) *Call {
+	recv := reflect.ValueOf(receiver)
+	for i := 0; i < recv.Type().NumMethod(); i++ {
+		if recv.Type().Method(i).Name == method {
+			return ctrl.RecordCallWithMethodType(receiver, method, recv.Method(i).Type(), args...)
+		}
+	}
+	ctrl.t.Fatalf("gomock: failed finding method %s on %T", method, receiver)
+	// In case t.Fatalf does not panic.
+	panic(fmt.Sprintf("gomock: failed finding method %s on %T", method, receiver))
+}
+
+func (ctrl *Controller) RecordCallWithMethodType(receiver interface{}, method string, methodType reflect.Type, args ...interface{}) *Call {
 	// TODO: check arity, types.
 	margs := make([]Matcher, len(args))
 	for i, arg := range args {
diff --git a/gomock/mock_matcher/mock_matcher.go b/gomock/mock_matcher/mock_matcher.go
index af92e88..d0bf885 100644
--- a/gomock/mock_matcher/mock_matcher.go
+++ b/gomock/mock_matcher/mock_matcher.go
@@ -40,7 +40,7 @@ func (_m *MockMatcher) Matches(_param0 interface{}) bool {
 
 // Matches indicates an expected call of Matches
 func (_mr *MockMatcherMockRecorder) Matches(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Matches", reflect.TypeOf((*MockMatcher)(nil).Matches), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Matches", reflect.TypeOf((*MockMatcher)(nil).Matches), arg0)
 }
 
 // String mocks base method
@@ -52,5 +52,5 @@ func (_m *MockMatcher) String() string {
 
 // String indicates an expected call of String
 func (_mr *MockMatcherMockRecorder) String() *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "String", reflect.TypeOf((*MockMatcher)(nil).String))
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "String", reflect.TypeOf((*MockMatcher)(nil).String))
 }
diff --git a/mockgen/mockgen.go b/mockgen/mockgen.go
index ac6b073..3b08c14 100644
--- a/mockgen/mockgen.go
+++ b/mockgen/mockgen.go
@@ -425,7 +425,7 @@ func (g *generator) GenerateMockRecorderMethod(mockType string, m *model.Method)
 			callArgs = ", _s..."
 		}
 	}
-	g.p(`return _mr.mock.ctrl.RecordCall(_mr.mock, "%s", reflect.TypeOf((*%s)(nil).%s)%s)`, m.Name, mockType, m.Name, callArgs)
+	g.p(`return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "%s", reflect.TypeOf((*%s)(nil).%s)%s)`, m.Name, mockType, m.Name, callArgs)
 
 	g.out()
 	g.p("}")
diff --git a/sample/mock_user/mock_user.go b/sample/mock_user/mock_user.go
index f518a52..59602ef 100644
--- a/sample/mock_user/mock_user.go
+++ b/sample/mock_user/mock_user.go
@@ -49,7 +49,7 @@ func (_m *MockIndex) Anon(_param0 string) {
 
 // Anon indicates an expected call of Anon
 func (_mr *MockIndexMockRecorder) Anon(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Anon", reflect.TypeOf((*MockIndex)(nil).Anon), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Anon", reflect.TypeOf((*MockIndex)(nil).Anon), arg0)
 }
 
 // Chan mocks base method
@@ -59,7 +59,7 @@ func (_m *MockIndex) Chan(_param0 chan int, _param1 chan<- hash.Hash) {
 
 // Chan indicates an expected call of Chan
 func (_mr *MockIndexMockRecorder) Chan(arg0, arg1 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Chan", reflect.TypeOf((*MockIndex)(nil).Chan), arg0, arg1)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Chan", reflect.TypeOf((*MockIndex)(nil).Chan), arg0, arg1)
 }
 
 // ConcreteRet mocks base method
@@ -71,7 +71,7 @@ func (_m *MockIndex) ConcreteRet() chan<- bool {
 
 // ConcreteRet indicates an expected call of ConcreteRet
 func (_mr *MockIndexMockRecorder) ConcreteRet() *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "ConcreteRet", reflect.TypeOf((*MockIndex)(nil).ConcreteRet))
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "ConcreteRet", reflect.TypeOf((*MockIndex)(nil).ConcreteRet))
 }
 
 // Ellip mocks base method
@@ -86,7 +86,7 @@ func (_m *MockIndex) Ellip(_param0 string, _param1 ...interface{}) {
 // Ellip indicates an expected call of Ellip
 func (_mr *MockIndexMockRecorder) Ellip(arg0 interface{}, arg1 ...interface{}) *gomock.Call {
 	_s := append([]interface{}{arg0}, arg1...)
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Ellip", reflect.TypeOf((*MockIndex)(nil).Ellip), _s...)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Ellip", reflect.TypeOf((*MockIndex)(nil).Ellip), _s...)
 }
 
 // EllipOnly mocks base method
@@ -100,7 +100,7 @@ func (_m *MockIndex) EllipOnly(_param0 ...string) {
 
 // EllipOnly indicates an expected call of EllipOnly
 func (_mr *MockIndexMockRecorder) EllipOnly(arg0 ...interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "EllipOnly", reflect.TypeOf((*MockIndex)(nil).EllipOnly), arg0...)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "EllipOnly", reflect.TypeOf((*MockIndex)(nil).EllipOnly), arg0...)
 }
 
 // ForeignFour mocks base method
@@ -110,7 +110,7 @@ func (_m *MockIndex) ForeignFour(_param0 imp4.Imp4) {
 
 // ForeignFour indicates an expected call of ForeignFour
 func (_mr *MockIndexMockRecorder) ForeignFour(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "ForeignFour", reflect.TypeOf((*MockIndex)(nil).ForeignFour), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "ForeignFour", reflect.TypeOf((*MockIndex)(nil).ForeignFour), arg0)
 }
 
 // ForeignOne mocks base method
@@ -120,7 +120,7 @@ func (_m *MockIndex) ForeignOne(_param0 imp1.Imp1) {
 
 // ForeignOne indicates an expected call of ForeignOne
 func (_mr *MockIndexMockRecorder) ForeignOne(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "ForeignOne", reflect.TypeOf((*MockIndex)(nil).ForeignOne), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "ForeignOne", reflect.TypeOf((*MockIndex)(nil).ForeignOne), arg0)
 }
 
 // ForeignThree mocks base method
@@ -130,7 +130,7 @@ func (_m *MockIndex) ForeignThree(_param0 imp3.Imp3) {
 
 // ForeignThree indicates an expected call of ForeignThree
 func (_mr *MockIndexMockRecorder) ForeignThree(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "ForeignThree", reflect.TypeOf((*MockIndex)(nil).ForeignThree), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "ForeignThree", reflect.TypeOf((*MockIndex)(nil).ForeignThree), arg0)
 }
 
 // ForeignTwo mocks base method
@@ -140,7 +140,7 @@ func (_m *MockIndex) ForeignTwo(_param0 imp2.Imp2) {
 
 // ForeignTwo indicates an expected call of ForeignTwo
 func (_mr *MockIndexMockRecorder) ForeignTwo(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "ForeignTwo", reflect.TypeOf((*MockIndex)(nil).ForeignTwo), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "ForeignTwo", reflect.TypeOf((*MockIndex)(nil).ForeignTwo), arg0)
 }
 
 // Func mocks base method
@@ -150,7 +150,7 @@ func (_m *MockIndex) Func(_param0 func(http.Request) (int, bool)) {
 
 // Func indicates an expected call of Func
 func (_mr *MockIndexMockRecorder) Func(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Func", reflect.TypeOf((*MockIndex)(nil).Func), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Func", reflect.TypeOf((*MockIndex)(nil).Func), arg0)
 }
 
 // Get mocks base method
@@ -162,7 +162,7 @@ func (_m *MockIndex) Get(_param0 string) interface{} {
 
 // Get indicates an expected call of Get
 func (_mr *MockIndexMockRecorder) Get(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Get", reflect.TypeOf((*MockIndex)(nil).Get), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Get", reflect.TypeOf((*MockIndex)(nil).Get), arg0)
 }
 
 // GetTwo mocks base method
@@ -175,7 +175,7 @@ func (_m *MockIndex) GetTwo(_param0 string, _param1 string) (interface{}, interf
 
 // GetTwo indicates an expected call of GetTwo
 func (_mr *MockIndexMockRecorder) GetTwo(arg0, arg1 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "GetTwo", reflect.TypeOf((*MockIndex)(nil).GetTwo), arg0, arg1)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "GetTwo", reflect.TypeOf((*MockIndex)(nil).GetTwo), arg0, arg1)
 }
 
 // Map mocks base method
@@ -185,7 +185,7 @@ func (_m *MockIndex) Map(_param0 map[int]hash.Hash) {
 
 // Map indicates an expected call of Map
 func (_mr *MockIndexMockRecorder) Map(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Map", reflect.TypeOf((*MockIndex)(nil).Map), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Map", reflect.TypeOf((*MockIndex)(nil).Map), arg0)
 }
 
 // NillableRet mocks base method
@@ -197,7 +197,7 @@ func (_m *MockIndex) NillableRet() error {
 
 // NillableRet indicates an expected call of NillableRet
 func (_mr *MockIndexMockRecorder) NillableRet() *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "NillableRet", reflect.TypeOf((*MockIndex)(nil).NillableRet))
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "NillableRet", reflect.TypeOf((*MockIndex)(nil).NillableRet))
 }
 
 // Other mocks base method
@@ -209,7 +209,7 @@ func (_m *MockIndex) Other() hash.Hash {
 
 // Other indicates an expected call of Other
 func (_mr *MockIndexMockRecorder) Other() *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Other", reflect.TypeOf((*MockIndex)(nil).Other))
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Other", reflect.TypeOf((*MockIndex)(nil).Other))
 }
 
 // Ptr mocks base method
@@ -219,7 +219,7 @@ func (_m *MockIndex) Ptr(_param0 *int) {
 
 // Ptr indicates an expected call of Ptr
 func (_mr *MockIndexMockRecorder) Ptr(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Ptr", reflect.TypeOf((*MockIndex)(nil).Ptr), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Ptr", reflect.TypeOf((*MockIndex)(nil).Ptr), arg0)
 }
 
 // Put mocks base method
@@ -229,7 +229,7 @@ func (_m *MockIndex) Put(_param0 string, _param1 interface{}) {
 
 // Put indicates an expected call of Put
 func (_mr *MockIndexMockRecorder) Put(arg0, arg1 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Put", reflect.TypeOf((*MockIndex)(nil).Put), arg0, arg1)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Put", reflect.TypeOf((*MockIndex)(nil).Put), arg0, arg1)
 }
 
 // Slice mocks base method
@@ -241,7 +241,7 @@ func (_m *MockIndex) Slice(_param0 []int, _param1 []byte) [3]int {
 
 // Slice indicates an expected call of Slice
 func (_mr *MockIndexMockRecorder) Slice(arg0, arg1 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Slice", reflect.TypeOf((*MockIndex)(nil).Slice), arg0, arg1)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Slice", reflect.TypeOf((*MockIndex)(nil).Slice), arg0, arg1)
 }
 
 // Struct mocks base method
@@ -251,7 +251,7 @@ func (_m *MockIndex) Struct(_param0 struct{}) {
 
 // Struct indicates an expected call of Struct
 func (_mr *MockIndexMockRecorder) Struct(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Struct", reflect.TypeOf((*MockIndex)(nil).Struct), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Struct", reflect.TypeOf((*MockIndex)(nil).Struct), arg0)
 }
 
 // StructChan mocks base method
@@ -261,7 +261,7 @@ func (_m *MockIndex) StructChan(_param0 chan struct{}) {
 
 // StructChan indicates an expected call of StructChan
 func (_mr *MockIndexMockRecorder) StructChan(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "StructChan", reflect.TypeOf((*MockIndex)(nil).StructChan), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "StructChan", reflect.TypeOf((*MockIndex)(nil).StructChan), arg0)
 }
 
 // Summary mocks base method
@@ -271,7 +271,7 @@ func (_m *MockIndex) Summary(_param0 *bytes.Buffer, _param1 io.Writer) {
 
 // Summary indicates an expected call of Summary
 func (_mr *MockIndexMockRecorder) Summary(arg0, arg1 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Summary", reflect.TypeOf((*MockIndex)(nil).Summary), arg0, arg1)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Summary", reflect.TypeOf((*MockIndex)(nil).Summary), arg0, arg1)
 }
 
 // Templates mocks base method
@@ -281,7 +281,7 @@ func (_m *MockIndex) Templates(_param0 template.CSS, _param1 template0.FuncMap)
 
 // Templates indicates an expected call of Templates
 func (_mr *MockIndexMockRecorder) Templates(arg0, arg1 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "Templates", reflect.TypeOf((*MockIndex)(nil).Templates), arg0, arg1)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "Templates", reflect.TypeOf((*MockIndex)(nil).Templates), arg0, arg1)
 }
 
 // MockEmbed is a mock of Embed interface
@@ -314,7 +314,7 @@ func (_m *MockEmbed) EmbeddedMethod() {
 
 // EmbeddedMethod indicates an expected call of EmbeddedMethod
 func (_mr *MockEmbedMockRecorder) EmbeddedMethod() *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "EmbeddedMethod", reflect.TypeOf((*MockEmbed)(nil).EmbeddedMethod))
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "EmbeddedMethod", reflect.TypeOf((*MockEmbed)(nil).EmbeddedMethod))
 }
 
 // ForeignEmbeddedMethod mocks base method
@@ -326,7 +326,7 @@ func (_m *MockEmbed) ForeignEmbeddedMethod() *bufio.Reader {
 
 // ForeignEmbeddedMethod indicates an expected call of ForeignEmbeddedMethod
 func (_mr *MockEmbedMockRecorder) ForeignEmbeddedMethod() *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "ForeignEmbeddedMethod", reflect.TypeOf((*MockEmbed)(nil).ForeignEmbeddedMethod))
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "ForeignEmbeddedMethod", reflect.TypeOf((*MockEmbed)(nil).ForeignEmbeddedMethod))
 }
 
 // ImplicitPackage mocks base method
@@ -336,7 +336,7 @@ func (_m *MockEmbed) ImplicitPackage(_param0 string, _param1 imp1.ImpT, _param2
 
 // ImplicitPackage indicates an expected call of ImplicitPackage
 func (_mr *MockEmbedMockRecorder) ImplicitPackage(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "ImplicitPackage", reflect.TypeOf((*MockEmbed)(nil).ImplicitPackage), arg0, arg1, arg2, arg3, arg4)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "ImplicitPackage", reflect.TypeOf((*MockEmbed)(nil).ImplicitPackage), arg0, arg1, arg2, arg3, arg4)
 }
 
 // RegularMethod mocks base method
@@ -346,7 +346,7 @@ func (_m *MockEmbed) RegularMethod() {
 
 // RegularMethod indicates an expected call of RegularMethod
 func (_mr *MockEmbedMockRecorder) RegularMethod() *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "RegularMethod", reflect.TypeOf((*MockEmbed)(nil).RegularMethod))
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "RegularMethod", reflect.TypeOf((*MockEmbed)(nil).RegularMethod))
 }
 
 // MockEmbedded is a mock of Embedded interface
@@ -379,5 +379,5 @@ func (_m *MockEmbedded) EmbeddedMethod() {
 
 // EmbeddedMethod indicates an expected call of EmbeddedMethod
 func (_mr *MockEmbeddedMockRecorder) EmbeddedMethod() *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "EmbeddedMethod", reflect.TypeOf((*MockEmbedded)(nil).EmbeddedMethod))
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "EmbeddedMethod", reflect.TypeOf((*MockEmbedded)(nil).EmbeddedMethod))
 }


Test patch:
diff --git a/gomock/controller_test.go b/gomock/controller_test.go
index 560ab0e..57f7957 100644
--- a/gomock/controller_test.go
+++ b/gomock/controller_test.go
@@ -119,11 +119,6 @@ func (s *Subject) BarMethod(arg string) int {
 	return 0
 }
 
-var (
-	FooMethodType = reflect.TypeOf((*Subject).FooMethod)
-	BarMethodType = reflect.TypeOf((*Subject).BarMethod)
-)
-
 func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
 	if !reflect.DeepEqual(expected, actual) {
 		t.Errorf("Expected %+v, but got %+v", expected, actual)
@@ -149,7 +144,7 @@ func TestExpectedMethodCall(t *testing.T) {
 	reporter, ctrl := createFixtures(t)
 	subject := new(Subject)
 
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument")
+	ctrl.RecordCall(subject, "FooMethod", "argument")
 	ctrl.Call(subject, "FooMethod", "argument")
 	ctrl.Finish()
 
@@ -171,7 +166,7 @@ func TestRepeatedCall(t *testing.T) {
 	reporter, ctrl := createFixtures(t)
 	subject := new(Subject)
 
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").Times(3)
+	ctrl.RecordCall(subject, "FooMethod", "argument").Times(3)
 	ctrl.Call(subject, "FooMethod", "argument")
 	ctrl.Call(subject, "FooMethod", "argument")
 	ctrl.Call(subject, "FooMethod", "argument")
@@ -188,7 +183,7 @@ func TestUnexpectedArgCount(t *testing.T) {
 	defer reporter.recoverUnexpectedFatal()
 	subject := new(Subject)
 
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument")
+	ctrl.RecordCall(subject, "FooMethod", "argument")
 	reporter.assertFatal(func() {
 		// This call is made with the wrong number of arguments...
 		ctrl.Call(subject, "FooMethod", "argument", "extra_argument")
@@ -207,7 +202,7 @@ func TestAnyTimes(t *testing.T) {
 	reporter, ctrl := createFixtures(t)
 	subject := new(Subject)
 
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").AnyTimes()
+	ctrl.RecordCall(subject, "FooMethod", "argument").AnyTimes()
 	for i := 0; i < 100; i++ {
 		ctrl.Call(subject, "FooMethod", "argument")
 	}
@@ -219,7 +214,7 @@ func TestMinTimes1(t *testing.T) {
 	// It fails if there are no calls
 	reporter, ctrl := createFixtures(t)
 	subject := new(Subject)
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").MinTimes(1)
+	ctrl.RecordCall(subject, "FooMethod", "argument").MinTimes(1)
 	reporter.assertFatal(func() {
 		ctrl.Finish()
 	})
@@ -227,14 +222,14 @@ func TestMinTimes1(t *testing.T) {
 	// It succeeds if there is one call
 	reporter, ctrl = createFixtures(t)
 	subject = new(Subject)
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").MinTimes(1)
+	ctrl.RecordCall(subject, "FooMethod", "argument").MinTimes(1)
 	ctrl.Call(subject, "FooMethod", "argument")
 	ctrl.Finish()
 
 	// It succeeds if there are many calls
 	reporter, ctrl = createFixtures(t)
 	subject = new(Subject)
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").MinTimes(1)
+	ctrl.RecordCall(subject, "FooMethod", "argument").MinTimes(1)
 	for i := 0; i < 100; i++ {
 		ctrl.Call(subject, "FooMethod", "argument")
 	}
@@ -245,20 +240,20 @@ func TestMaxTimes1(t *testing.T) {
 	// It succeeds if there are no calls
 	_, ctrl := createFixtures(t)
 	subject := new(Subject)
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").MaxTimes(1)
+	ctrl.RecordCall(subject, "FooMethod", "argument").MaxTimes(1)
 	ctrl.Finish()
 
 	// It succeeds if there is one call
 	_, ctrl = createFixtures(t)
 	subject = new(Subject)
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").MaxTimes(1)
+	ctrl.RecordCall(subject, "FooMethod", "argument").MaxTimes(1)
 	ctrl.Call(subject, "FooMethod", "argument")
 	ctrl.Finish()
 
 	//It fails if there are more
 	reporter, ctrl := createFixtures(t)
 	subject = new(Subject)
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").MaxTimes(1)
+	ctrl.RecordCall(subject, "FooMethod", "argument").MaxTimes(1)
 	ctrl.Call(subject, "FooMethod", "argument")
 	reporter.assertFatal(func() {
 		ctrl.Call(subject, "FooMethod", "argument")
@@ -270,7 +265,7 @@ func TestMinMaxTimes(t *testing.T) {
 	// It fails if there are less calls than specified
 	reporter, ctrl := createFixtures(t)
 	subject := new(Subject)
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").MinTimes(2).MaxTimes(2)
+	ctrl.RecordCall(subject, "FooMethod", "argument").MinTimes(2).MaxTimes(2)
 	ctrl.Call(subject, "FooMethod", "argument")
 	reporter.assertFatal(func() {
 		ctrl.Finish()
@@ -279,7 +274,7 @@ func TestMinMaxTimes(t *testing.T) {
 	// It fails if there are more calls than specified
 	reporter, ctrl = createFixtures(t)
 	subject = new(Subject)
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").MinTimes(2).MaxTimes(2)
+	ctrl.RecordCall(subject, "FooMethod", "argument").MinTimes(2).MaxTimes(2)
 	ctrl.Call(subject, "FooMethod", "argument")
 	ctrl.Call(subject, "FooMethod", "argument")
 	reporter.assertFatal(func() {
@@ -289,7 +284,7 @@ func TestMinMaxTimes(t *testing.T) {
 	// It succeeds if there is just the right number of calls
 	reporter, ctrl = createFixtures(t)
 	subject = new(Subject)
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").MaxTimes(2).MinTimes(2)
+	ctrl.RecordCall(subject, "FooMethod", "argument").MaxTimes(2).MinTimes(2)
 	ctrl.Call(subject, "FooMethod", "argument")
 	ctrl.Call(subject, "FooMethod", "argument")
 	ctrl.Finish()
@@ -301,7 +296,7 @@ func TestDo(t *testing.T) {
 
 	doCalled := false
 	var argument string
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "argument").Do(
+	ctrl.RecordCall(subject, "FooMethod", "argument").Do(
 		func(arg string) {
 			doCalled = true
 			argument = arg
@@ -327,8 +322,8 @@ func TestReturn(t *testing.T) {
 	subject := new(Subject)
 
 	// Unspecified return should produce "zero" result.
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "zero")
-	ctrl.RecordCall(subject, "FooMethod", FooMethodType, "five").Return(5)
+	ctrl.RecordCall(subject, "FooMethod", "zero")
+	ctrl.RecordCall(subject, "FooMethod", "five").Return(5)
 
 	assertEqual(
 		t,
@@ -348,10 +343,10 @@ func TestUnorderedCalls(t *testing.T) {
 	subjectTwo := new(Subject)
 	subjectOne := new(Subject)
 
-	ctrl.RecordCall(subjectOne, "FooMethod", FooMethodType, "1")
-	ctrl.RecordCall(subjectOne, "BarMethod", BarMethodType, "2")
-	ctrl.RecordCall(subjectTwo, "FooMethod", FooMethodType, "3")
-	ctrl.RecordCall(subjectTwo, "BarMethod", BarMethodType, "4")
+	ctrl.RecordCall(subjectOne, "FooMethod", "1")
+	ctrl.RecordCall(subjectOne, "BarMethod", "2")
+	ctrl.RecordCall(subjectTwo, "FooMethod", "3")
+	ctrl.RecordCall(subjectTwo, "BarMethod", "4")
 
 	// Make the calls in a different order, which should be fine.
 	ctrl.Call(subjectOne, "BarMethod", "2")
@@ -373,9 +368,9 @@ func commonTestOrderedCalls(t *testing.T) (reporter *ErrorReporter, ctrl *gomock
 	subjectTwo = new(Subject)
 
 	gomock.InOrder(
-		ctrl.RecordCall(subjectOne, "FooMethod", FooMethodType, "1").AnyTimes(),
-		ctrl.RecordCall(subjectTwo, "FooMethod", FooMethodType, "2"),
-		ctrl.RecordCall(subjectTwo, "BarMethod", BarMethodType, "3"),
+		ctrl.RecordCall(subjectOne, "FooMethod", "1").AnyTimes(),
+		ctrl.RecordCall(subjectTwo, "FooMethod", "2"),
+		ctrl.RecordCall(subjectTwo, "BarMethod", "3"),
 	)
 
 	return
@@ -428,9 +423,9 @@ func TestCallAfterLoopPanic(t *testing.T) {
 
 	subject := new(Subject)
 
-	firstCall := ctrl.RecordCall(subject, "FooMethod", FooMethodType, "1")
-	secondCall := ctrl.RecordCall(subject, "FooMethod", FooMethodType, "2")
-	thirdCall := ctrl.RecordCall(subject, "FooMethod", FooMethodType, "3")
+	firstCall := ctrl.RecordCall(subject, "FooMethod", "1")
+	secondCall := ctrl.RecordCall(subject, "FooMethod", "2")
+	thirdCall := ctrl.RecordCall(subject, "FooMethod", "3")
 
 	gomock.InOrder(firstCall, secondCall, thirdCall)
 
@@ -450,7 +445,7 @@ func TestPanicOverridesExpectationChecks(t *testing.T) {
 	reporter := NewErrorReporter(t)
 
 	reporter.assertFatal(func() {
-		ctrl.RecordCall(new(Subject), "FooMethod", FooMethodType, "1")
+		ctrl.RecordCall(new(Subject), "FooMethod", "1")
 		defer ctrl.Finish()
 		reporter.Fatalf("Intentional panic")
 	})
@@ -463,7 +458,7 @@ func TestSetArgWithBadType(t *testing.T) {
 	s := new(Subject)
 	// This should catch a type error:
 	rep.assertFatal(func() {
-		ctrl.RecordCall(s, "FooMethod", FooMethodType, "1").SetArg(0, "blah")
+		ctrl.RecordCall(s, "FooMethod", "1").SetArg(0, "blah")
 	})
 	ctrl.Call(s, "FooMethod", "1")
 }
@@ -473,7 +468,7 @@ func TestTimes0(t *testing.T) {
 	defer ctrl.Finish()
 
 	s := new(Subject)
-	ctrl.RecordCall(s, "FooMethod", FooMethodType, "arg").Times(0)
+	ctrl.RecordCall(s, "FooMethod", "arg").Times(0)
 	rep.assertFatal(func() {
 		ctrl.Call(s, "FooMethod", "arg")
 	})
diff --git a/mockgen/tests/unexported_method/bugreport_mock.go b/mockgen/tests/unexported_method/bugreport_mock.go
index 8f30bbe..f1a16d8 100644
--- a/mockgen/tests/unexported_method/bugreport_mock.go
+++ b/mockgen/tests/unexported_method/bugreport_mock.go
@@ -40,5 +40,5 @@ func (_m *MockExample) someMethod(_param0 string) string {
 
 // someMethod indicates an expected call of someMethod
 func (_mr *MockExampleMockRecorder) someMethod(arg0 interface{}) *gomock.Call {
-	return _mr.mock.ctrl.RecordCall(_mr.mock, "someMethod", reflect.TypeOf((*MockExample)(nil).someMethod), arg0)
+	return _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, "someMethod", reflect.TypeOf((*MockExample)(nil).someMethod), arg0)
 }