-
Notifications
You must be signed in to change notification settings - Fork 365
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
Fix gradle build files parsing issues #4045
Conversation
Thanks for diving in for a fix! Let us know when you'd consider this ready for review. |
241ac97
to
05eb162
Compare
I've got one question though... it seems that the issue i'm trying to fix is not related to the ChangeDependency recipe specifically but rather the gradle parser in general. Is there a better place to put the test? |
Indeed looks like you're fixing a parser bug instead; that should help even more folks & cases, thanks! Might be easier to reproduce in a smaller test as seen in these tree test examples. Does that help? |
Yes it absolutely helped. The tests have been successfully moved there and I may have found another bug when an inner class is imported. The last thing is about the FIXME that i left in GroovyTypeMapping... it is a private method and the signature change does not seem to bother the two usages. Unfortunately I was not able to reproduce it in unit test. Does this change require a unit test ? |
rewrite-groovy/src/main/java/org/openrewrite/groovy/GroovyTypeMapping.java
Outdated
Show resolved
Hide resolved
Glad to hear that helped! The new smaller tests look much cleaner indeed. I'm tagging Knut or Shannon for a review here, as they have more experience with the Groovy/Gradle parsers, and are more likely to spot any possible impact I might overlook. I'd think it's fine not to add the explicit test you mentioned if it's very awkward to trigger or test for, but perhaps they feel differently. |
rewrite-groovy/src/main/java/org/openrewrite/groovy/GroovyParserVisitor.java
Show resolved
Hide resolved
Build failed because:
It does not seem related to my change ... |
What's changed?
Improved the groovy parser to support:
ProcessBuilder.Redirect.to(..)
calln.@conf = 'runtime->default;docs->docs;sources->sources'
What's your motivation?
I tried to use the ChangeDependency recipe on an old gradle build with lots of custom code
Anything in particular you'd like reviewers to focus on?
GroovyTypeMapping#classType
, in production i've encountered someClassCastException
whereJavaType.Unknown
cannot be casted toJavaType.Class
but i was not able to reproduce in unit tests. I found that downcasting toJavaType.FullyQualified
avoids the CCE and does not seem to break something elseAnyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Any additional context
Checklist