Skip to content
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

Exception "Could resolve the return type of the lambda at" #2316

Closed
boris779 opened this issue Jun 16, 2021 · 1 comment
Closed

Exception "Could resolve the return type of the lambda at" #2316

boris779 opened this issue Jun 16, 2021 · 1 comment
Labels
🐛 bug Defect / Bug 🙅 wontfix This will not be worked on

Comments

@boris779
Copy link

boris779 commented Jun 16, 2021

Describe the bug
Always get an Exception when starting cucumber tests with a runConfig in IntelliJ or with java command line:

/home/boris/.jdks/openjdk-15.0.1/bin/java -javaagent:/home/boris/idea/lib/idea_rt.jar=32965:/home/boris/idea/bin -Dfile.encoding=UTF-8 -classpath /home/boris/repos --tags @boris --plugin json:target/cucumber-report/json/desktop.json --plugin html:target/cucumber-report/html/desktop-portal --glue at.xxxxxxx_webtest.step_definitions src/test/resources/features

OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
Jun 16, 2021 1:47:06 PM io.cucumber.core.runtime.Runtime run
SEVERE: Exception while executing pickle
java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Could resolve the return type of the lambda at CommonSteps.kt:15
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at io.cucumber.core.runtime.Runtime.run(Runtime.java:93)
	at io.cucumber.core.cli.Main.run(Main.java:92)
	at io.cucumber.core.cli.Main.main(Main.java:34)
Caused by: java.lang.IllegalStateException: Could resolve the return type of the lambda at CommonSteps.kt:15
	at io.cucumber.java8.AbstractGlueDefinition.resolveRawArguments(AbstractGlueDefinition.java:80)
	at io.cucumber.java8.Java8StepDefinition.<init>(Java8StepDefinition.java:25)
	at io.cucumber.java8.Java8StepDefinition.create(Java8StepDefinition.java:40)
	at io.cucumber.java8.De.Dann(De.java:387)
	at at.xxxxxxxxx.step_definitions.CommonSteps.<init>(CommonSteps.kt:15)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
	at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)
	at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
	at io.cucumber.picocontainer.PicoFactory.getInstance(PicoFactory.java:49)
	at io.cucumber.java8.Java8Backend.buildWorld(Java8Backend.java:64)
	at io.cucumber.core.runner.Runner.buildBackendWorlds(Runner.java:101)
	at io.cucumber.core.runner.Runner.runPickle(Runner.java:67)
	at io.cucumber.core.runtime.Runtime.lambda$execute$5(Runtime.java:110)
	at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
	at io.cucumber.core.runtime.Runtime.lambda$execute$6(Runtime.java:110)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
	at io.cucumber.core.runtime.Runtime$SameThreadExecutorService.execute(Runtime.java:233)
	at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
	at io.cucumber.core.runtime.Runtime.lambda$run$2(Runtime.java:86)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.stream.SliceOps$1$1.accept(SliceOps.java:199)
	at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1602)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at io.cucumber.core.runtime.Runtime.run(Runtime.java:87)
	... 2 more

To Reproduce
Steps to reproduce the behavior:

  1. Compile selenium/cucumber tests
  2. See error

Expected behavior
It was running since 3 years, but since yesterday I have trouble to run it directly in IntelliJ as CucumberTest

Your Environment

  • Versions used 6.10.4
  • Operating System and version Ubuntu 20.10.
  • Build tool mvn (IntelliJ 2021.1.2)
  • Kotlin as Compiler

Additional context
when running test from commandline via mvn, there is no error

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Jun 16, 2021

If you look at the code you can see that we are using typetools.

Class<?>[] resolveRawArguments(Class<?> bodyClass, Class<?> body) {
Class<?>[] rawArguments = TypeResolver.resolveRawArguments(bodyClass, body);
for (Class<?> aClass : rawArguments) {
if (TypeResolver.Unknown.class.equals(aClass)) {
throw new IllegalStateException("" +
"Could resolve the return type of the lambda at " + location.getFileName() + ":"
+ location.getLineNumber());
}
}
return rawArguments;

Typetools uses implementation details of the JDK to determine the types of lambda method. As such it is likely that you are using an exotic JDK. And because you are using IDEA you may be using IDEA's built-in compiler by mistake (see https://stackoverflow.com/a/67817085/3945473).

Your options are:

1 ) Ensure you are using a regular JDK
2) Debug typetools
3) Provide a fix to typetools to support IDEA's compiler or your current JDK.

This is less then ideal and as such we are considering cucumber-lambda as a replacement for cucumber-java8.

@aurelien-reeves aurelien-reeves added the 🐛 bug Defect / Bug label Jun 25, 2021
@mpkorstanje mpkorstanje added the 🙅 wontfix This will not be worked on label Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Defect / Bug 🙅 wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants