-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[java8] support lambda references to Kotlin value class #2342
Comments
There is an unrelated mistake in the regex of the parameter type of your reproducer. So to make this discussion easier I will be using this parameter type declaration to trigger the exception: package com.example.bug
import io.cucumber.java8.En
class HtmlSafeStringStepdefs : En {
init {
ParameterType("html_safe_string", "html_safe\\(\"(.*)\"\\)") { string: String ->
HtmlSafeString(string)
}
}
} And this is essentially the same as using a lambda reference: package com.example.bug
import io.cucumber.java8.En
class HtmlSafeStringStepdefs: En {
var htmlSafeString: HtmlSafeString? = null
init {
ParameterType("html_safe_string", "html_safe\\(\"(.*)\"\\)", ::HtmlSafeString)
}
} When declaring a Because And we want to get the non-bridge Unfortunately this gets a bit complicated when the target is a method reference to a value class. Because the class is inlined the real method has been name mangled into As such you have the following options.
package com.example.bug
import io.cucumber.java8.En
class HtmlSafeStringStepdefs : En {
init {
ParameterType("html_safe_string", "html_safe\\(\".*\"\\)") { string: String ->
{
HtmlSafeString(string)
}
}
}
}
|
Option 3 seems a bit tricky so I might be going with option 2. Edit: Scratch that, option 2 doesn't work for me. Also, I see there is wind of cucumber-java8 being deprecated. Is the replacement available? Maybe it doesn't have the issue. |
We're considering a lambda based implementation in #2279. It'd need someone willing to implement it. |
With |
Given you are implementing a feature:
And step definitions:
And supposing you implemented the class like this:
When you compile, everything goes fine.
Then when you run, you expect the specifications to be run.
But you actually get this:
Demo repository here
Where I actually hit this was trying to wrap
Tuple
intoPoint
andVector
value classes for Red Rocket.The text was updated successfully, but these errors were encountered: