-
Notifications
You must be signed in to change notification settings - Fork 77
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
ClassCastException when using JMockitBlockToMockito #619
Comments
Thanks for using the very latest to verify; I think the problem is with the unexpected |
Yes, you're right. Can't really understand why someone writes it like that.
Here the ClassCastException happens because the Recipe expects a J.Block but gets a MethodInvocation w/ 'private void entityResolver()'. I never used JMockit, so i can't tell if that's usual procedure. Is there any way to have a recipe run through ALL files and just continue with the next file if it fails with one? |
When I've seen these types of errors, unfortunately I just delete the file temporarily and rerun. But, yes, it would be great if the framework could keep running for files if see any exception - maybe a flag if don't want to default this? @sambsnyd @timtebeek fyi In any case, this is a bug if it is generate the exception. The code is unusual however, and with the private method internal to the block, it doesn't seem to follow the expected structure of a Jmockit Expectations block: https://www.javadoc.io/doc/org.jmockit/jmockit/latest/mockit/Expectations.html |
Was able to replicate it:
Caused by: java.lang.ClassCastException: class org.openrewrite.java.tree.J$MethodDeclaration cannot be cast to class org.openrewrite.java.tree.J$Block (org.openrewrite.java.tree.J$MethodDeclaration and org.openrewrite.java.tree.J$Block are in unnamed module of loader 'app') |
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Maven plugin, and my project is a multi-module project.
What is the smallest, simplest way to reproduce the problem?
What did you see instead?
Caused by: java.lang.ClassCastException: class org.openrewrite.java.tree.J$FieldAccess cannot be cast to class org.openrewrite.java.tree.J$Identifier (org.openrewrite.java.tree.J$FieldAccess and org.openrewrite.java.tree.J$Identifier are in unnamed module of loader org.codehaus.plexus.classworlds.realm.ClassRealm @201fd61a)
What is the full stack trace of any errors you encountered?
Are you interested in [contributing a fix to OpenRewrite]
don't know if i'm able
The text was updated successfully, but these errors were encountered: