Skip to content

Commit 1952349

Browse files
authored
Merge pull request #184 from cucumber/scala3prep2
Convert Manifest to Java Type sooner
2 parents 08568ee + c502085 commit 1952349

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

cucumber-scala/src/main/scala/io/cucumber/scala/ScalaDslRegistry.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package io.cucumber.scala
22

33
import io.cucumber.scala.HookType.{AFTER, AFTER_STEP, BEFORE, BEFORE_STEP}
44

5-
class ScalaDslRegistry {
5+
final class ScalaDslRegistry {
66

77
private var _stepDefinitions: Seq[ScalaStepDetails] = Seq()
88

cucumber-scala/src/main/scala/io/cucumber/scala/ScalaStepDefinition.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.cucumber.scala
22

3+
import java.lang.reflect.{Type => JType}
34
import java.util.{List => JList}
45

56
import io.cucumber.core.backend.{ParameterInfo, ScenarioScoped, StepDefinition}
@@ -16,9 +17,8 @@ trait ScalaStepDefinition extends StepDefinition with AbstractGlueDefinition {
1617
stepDetails.types
1718
)
1819

19-
private def fromTypes(types: Seq[Manifest[_]]): JList[ParameterInfo] = {
20+
private def fromTypes(types: Seq[JType]): JList[ParameterInfo] = {
2021
types
21-
.map(ScalaTypeHelper.asJavaType)
2222
.map(new ScalaTypeResolver(_))
2323
.map(new ScalaParameterInfo(_))
2424
.toList
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.cucumber.scala
22

3+
import java.lang.reflect.{Type => JType}
4+
35
/** Implementation of step definition for scala.
46
*
57
* @param frame Representation of a stack frame containing information about the context in which a
@@ -9,10 +11,10 @@ package io.cucumber.scala
911
* @param types Parameters types of body step definition
1012
* @param body Function body of a step definition. This is what actually runs the code within the step def.
1113
*/
12-
case class ScalaStepDetails(
14+
private[scala] case class ScalaStepDetails(
1315
frame: StackTraceElement,
1416
name: String,
1517
pattern: String,
16-
types: Seq[Manifest[_]],
18+
types: Seq[JType],
1719
body: List[Any] => Any
1820
)

cucumber-scala/src/main/scala/io/cucumber/scala/StepDsl.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,8 +1532,9 @@ private[scala] trait StepDsl extends BaseScalaDsl {
15321532
private def register(
15331533
manifests: Manifest[_ <: Any]*
15341534
)(pf: PartialFunction[List[Any], Any]): Unit = {
1535+
val types = manifests.map(ScalaTypeHelper.asJavaType)
15351536
registry.registerStep(
1536-
ScalaStepDetails(Utils.frame(self), name, regex, manifests, pf)
1537+
ScalaStepDetails(Utils.frame(self), name, regex, types, pf)
15371538
)
15381539
}
15391540

0 commit comments

Comments
 (0)