-
-
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
Kotlin and Java8 lamda parsing results in ArrayIndexOutOfBoundsException #1123
Comments
The implementation of t he `ConstantPoolTypeIntrospector` supported: - Reference to a static method - Reference to an instance method of a particular object - Reference to a constructor But did not support: - Reference to an instance method of an arbitrary object of a particular type Referencing instances methods would result in an index out of bounds exception as the step definition interface was expecting exactly 1 more argument then was bound to the body. We now use this discrepancy to detect if this is an instance method reference and include the the instance class as the first type. Related issues: - #1123 - #1126 This fixes #1126
The implementation of t he `ConstantPoolTypeIntrospector` did not fully support closures. Using a closure without scoped variables would result in a null pointer exception. E.g: ```java Given("^A statement with a body expression$") { assertTrue(true) } ``` This is resolved check if the member reference method equals the magic constant "INSTANCE" and return no type arguments. Related issues: - #1123 - #1126 This fixes #1123
Very interesting. Can you try building support-java-8-method-references locally and add a dependency to This should solve the problem. |
The implementation of t he `ConstantPoolTypeIntrospector` supported: - Reference to a static method - Reference to an instance method of a particular object - Reference to a constructor But did not support: - Reference to an instance method of an arbitrary object of a particular type Referencing instances methods would result in an index out of bounds exception as the step definition interface was expecting exactly 1 more argument then was bound to the body. We now use this discrepancy to detect if this is an instance method reference and include the the instance class as the first type. Related issues: - #1123 - #1126 This fixes #1126
The implementation of t he `ConstantPoolTypeIntrospector` did not fully support closures. Using a closure without scoped variables would result in a null pointer exception. E.g: ```java Given("^A statement with a body expression$") { assertTrue(true) } ``` This is resolved check if the member reference method equals the magic constant "INSTANCE" and return no type arguments. Related issues: - #1123 - #1126 This fixes #1123
The implementation of t he `ConstantPoolTypeIntrospector` did not fully support closures. Using a closure without scoped variables would result in a null pointer exception. E.g: ```java Given("^A statement with a body expression$") { assertTrue(true) } ``` This is resolved check if the member reference method equals the magic constant "INSTANCE" and return no type arguments. Related issues: - #1123 - #1126 This fixes #1123
Hi, I had the same issue and I can verify this works, I was getting
But after building the support-java-8-method-references branch and updating the dependencies, everything worked OK. PS. I tried for a couple of days with a Gradle project but I was getting this error
So I got it working with maven. |
The implementation of t he `ConstantPoolTypeIntrospector` did not fully support closures. Using a closure without scoped variables would result in a null pointer exception. E.g: ```java Given("^A statement with a body expression$") { assertTrue(true) } ``` This is resolved check if the member reference method equals the magic constant "INSTANCE" and return no type arguments. Related issues: - #1123 - #1126 This fixes #1123
Cheers! PS: Owh yeah. Looks like using dependency management in a profile is a bad practice and gradle doesn't grok it. I have pushed a new commit that should fix this. |
The implementation of t he `ConstantPoolTypeIntrospector` did not fully support closures. Using a closure without scoped variables would result in a null pointer exception. E.g: ```java Given("^A statement with a body expression$") { assertTrue(true) } ``` This is resolved check if the member reference method equals the magic constant "INSTANCE" and return no type arguments. Related issues: - #1123 - #1126 This fixes #1123
The implementation of t he `ConstantPoolTypeIntrospector` did not fully support closures. Using a closure without scoped variables would result in a null pointer exception. E.g: ```java Given("^A statement with a body expression$") { assertTrue(true) } ``` This is resolved check if the member reference method equals the magic constant "INSTANCE" and return no type arguments. Related issues: - #1123 - #1126 This fixes #1123
The implementation of t he `ConstantPoolTypeIntrospector` did not fully support closures. Using a closure without scoped variables would result in a null pointer exception. E.g: ```java Given("^A statement with a body expression$") { assertTrue(true) } ``` This is resolved check if the member reference method equals the magic constant "INSTANCE" and return no type arguments. Related issues: - #1123 - #1126 This fixes #1123
Also for future reference. |
The implementation of t he `ConstantPoolTypeIntrospector` did not fully support closures. Using a closure without scoped variables would result in a null pointer exception. E.g: ```java Given("^A statement with a body expression$") { assertTrue(true) } ``` This is resolved check if the member reference method equals the magic constant "INSTANCE" and return no type arguments. Related issues: - #1123 - #1126 This fixes #1123
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm running with a Cucumber JVM feature file, using Java8 and PicoContainer. Here's my feature:
Running this step in Kotlin causes an error:
While this Java class runs just fine:
This Kotlin step also runs fine, so you can see this is pretty unpredictable:
The Runner, for completion:
Stacktrace is:
Other things you might want to look at:
My Github code, with Kotlin step commented out
Dan's response on Stackoverflow
I am happy to act as tester on this one if you would like.
The text was updated successfully, but these errors were encountered: