Skip to content

Commit 9c90f0f

Browse files
committed
Manually provide component functions for captor holder classes
This tightens the public API for these classes.
1 parent f440583 commit 9c90f0f

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

mockito-kotlin/src/main/kotlin/com/nhaarman/mockitokotlin2/ArgumentCaptor.kt

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,33 @@ inline fun <reified A : Any, reified B : Any, reified C : Any> argumentCaptor(
6464
)
6565
}
6666

67-
data class ArgumentCaptorHolder4<out A, out B, out C, out D>(
68-
val first: A, val second: B, val third: C, val fourth: D
69-
)
67+
class ArgumentCaptorHolder4<out A, out B, out C, out D>(
68+
val first: A,
69+
val second: B,
70+
val third: C,
71+
val fourth: D
72+
) {
73+
74+
operator fun component1() = first
75+
operator fun component2() = second
76+
operator fun component3() = third
77+
operator fun component4() = fourth
78+
}
7079

71-
data class ArgumentCaptorHolder5<out A, out B, out C, out D, out E>(
72-
val first: A, val second: B, val third: C, val fourth: D, val fifth: E
73-
)
80+
class ArgumentCaptorHolder5<out A, out B, out C, out D, out E>(
81+
val first: A,
82+
val second: B,
83+
val third: C,
84+
val fourth: D,
85+
val fifth: E
86+
) {
87+
88+
operator fun component1() = first
89+
operator fun component2() = second
90+
operator fun component3() = third
91+
operator fun component4() = fourth
92+
operator fun component5() = fifth
93+
}
7494

7595

7696
/**

0 commit comments

Comments
 (0)