Skip to content

Commit 98a45a4

Browse files
Ensuring the correct method is being called
There are more than one non-bridge method generated and returned by the `getDeclaredMethods` call. In order to ensure that we retrieve the correct one, we match on the exact name, i.e. on the `apply` function.
1 parent 8e232b4 commit 98a45a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scala/src/main/scala/cucumber/api/scala/ScalaDsl.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,6 @@ trait ScalaDsl { self =>
492492
}
493493

494494
private def functionParams(f: Any) =
495-
f.getClass.getDeclaredMethods.filterNot(_.isBridge).head.getGenericParameterTypes
495+
f.getClass.getDeclaredMethods.filter(m => "apply".equals(m.getName) && !m.isBridge).head.getGenericParameterTypes
496496
}
497497
}

0 commit comments

Comments
 (0)