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

Not possible to define dependent classes as SourceSpecs inside the test #5123

Open
mpet opened this issue Mar 4, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@mpet
Copy link

mpet commented Mar 4, 2025

What version of OpenRewrite are you using?

I tried the following version:
<rewrite.java.version>8.47.3</rewrite.java.version>

Error message:

%ERROR  3,testRecipe2(com.company.commonlibrary.openrewriterecipes.mje.ReplaceRmConfigurationMethodTest)
%TRACES 
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)~~>*/Mje
https://docs.openrewrite.org/reference/faq#im-seeing-lst-contains-missing-or-invalid-type-information-in-my-recipe-unit-tests-how-to-resolve
        at org.openrewrite.java.Assertions.assertValidTypes(Assertions.java:124)
        at org.openrewrite.java.Assertions.validateTypes(Assertions.java:61)
        at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:508)
        at org.openrewrite.test.RewriteTest.rewriteRun(RewriteTest.java:129)
        at com.company.commonlibrary.openrewriterecipes.mje.ReplaceRmConfigurationMethodTest.testRecipe2(ReplaceRmConfigurationMethodTest.java:55)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

%TRACEE 

The error message does not really tell what is wrong since the type is included in test using SourceSpec.

These classes should be possible to run and they can be found in this slack thread

https://rewriteoss.slack.com/archives/C01A843MWG5/p1741007730479919

br,

//mikael

@mpet mpet added the bug Something isn't working label Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant