-
Notifications
You must be signed in to change notification settings - Fork 86
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
SimplifyWebTestClientCalls does not work on Kotlin code #663
SimplifyWebTestClientCalls does not work on Kotlin code #663
Conversation
…inTest to reproduce the issue with SimplifyWebTestClientCalls on Kotlin code
Thanks a lot @barbulescu ; you've stumbled upon an issue with the underlying KotlinParser, which I've logged here: That meant that literals of the type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions could not be made:
- src/main/java/org/openrewrite/java/spring/http/SimplifyWebTestClientCalls.java
- lines 30-31
You've uncovered another imperfection with the way we represent types that come from Java libraries in Kotlin: That'll negatively affect our ability to match methods used in Kotlin code, such that existing recipes might not match where they should. We should take a closer look in rewrite-kotlin in how that type information is built up, and ensure Java types are used, or adjust the matcher to match both Java and Kotlin types for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the necessary adjustments to make this work for Kotlin as well, and helping uncover two imperfections upstream in rewrite-kotlin, and the help in getting one of those cleared out already. We'll merge this iteration and can separately look to cover the HttpStatus case you're after indeed.
What's changed?
Add support for both int (Java) and long (Kotlin) status code types.
What's your motivation?
Have this recipe work on Kotlin code.
Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Any additional context
Followed the instructions on Discord.
Wanted to add support for HttpStatus argument but one extra step is to remove the import if not used anywhere else.
Decided to have a follow-up PR for this fix.
Checklist