Skip to content

Commit 26b28bb

Browse files
committed
refactor: 💡 Convert Manifest to Java Type sooner
This will benefit the Scala3 migration as Manifest won't exist anymore and we will need to convert to Java Type in another way sooner as well
1 parent ecf18ae commit 26b28bb

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

‎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

‎cucumber-scala/src/main/scala/io/cucumber/scala/ScalaStepDetails.scala

Lines changed: 3 additions & 1 deletion
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
@@ -13,6 +15,6 @@ 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)