You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the smallest, simplest way to reproduce the problem?
Based on the rewrite starter recipe, I am trying to write a simple replacement that references the jar io.kotest:kotest-property-jvm, however it fails on parsing
import io.kotest.property.arbitrary.next
import io.kotest.property.arbitrary.UUIDVersion
import io.kotest.property.Arb
import org.openrewrite.java.internal.template.__M__;
import org.openrewrite.java.internal.template.__P__;
class Template {
var o : Object =
/*__TEMPLATE__*/Arb.uuid(UUIDVersion.V4, false).next()/*__TEMPLATE_STOP__*/
;
}
java.lang.IllegalStateException: LST contains missing or invalid type information
Identifier->MethodInvocation->MethodInvocation->NamedVariable->VariableDeclarations->Block->MethodDeclaration->Block->ClassDeclaration->CompilationUnit
/*~~(Identifier type is missing or malformed)~~>*/Arb
at org.openrewrite.kotlin.Assertions.assertValidTypes(Assertions.java:235)
at org.openrewrite.kotlin.Assertions.validateTypes(Assertions.java:56)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:508)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:132)
at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:127)
at com.yourorg.ArbTransformTest.kotlinFoo(ArbTransformTest.kt:27)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
The artifact is included in the project via testRuntimeOnly("io.kotest:kotest-property:5.9.1")
If I add spec.typeValidationOptions(TypeValidation.none()) to the test, it passes, ideally would like to avoid this.
Thanks for reporting your issue here as well; indeed puzzling why that doesn't just work; perhaps it's something with how that Arb is defined that's tripping us up here. I don't see anything obviously wrong with your recipe or tests. Having them layed out together like this is really helpful.
That's helpful context, thanks! Indeed could well be that we don't yet map those to classes. Not sure if we should, but it sounds like we have the beginnings of a unit test to explore this omission. Is that unit test something you'd like to push up to a draft PR to explore a potential fix?
I am using
How are you running OpenRewrite?
Using openrewrite with kotlin/gradle plugin, single module
Following on from slack conversation at https://rewriteoss.slack.com/archives/C01A843MWG5/p1721744738864449?thread_ts=1721135504.974819&cid=C01A843MWG5
What is the smallest, simplest way to reproduce the problem?
Based on the rewrite starter recipe, I am trying to write a simple replacement that references the jar io.kotest:kotest-property-jvm, however it fails on parsing
Error when running the test is
The artifact is included in the project via
testRuntimeOnly("io.kotest:kotest-property:5.9.1")
If I add
spec.typeValidationOptions(TypeValidation.none())
to the test, it passes, ideally would like to avoid this.Are you interested in contributing a fix to OpenRewrite?
Happy to help where I can
The text was updated successfully, but these errors were encountered: