Fixing the application of DoesNotIncludeDependency against files of the incorrect type.#5758
Conversation
956aabf to
bece592
Compare
|
I'm not sure I understand exactly what the issue is here. rewrite/rewrite-core/src/main/java/org/openrewrite/Preconditions.java Lines 65 to 67 in 41ce444 Preconditions.not marks every sourcefile that is not acceptable, but if the recipes(visitors) that come after that have the appropriate isAcceptable checks, that's fine right?
|
6a96f31 to
33cd43e
Compare
The problem was that when it would call the |
… the incorrect type.
…igher level shared recipe.
33cd43e to
1e0aa4a
Compare
timtebeek
left a comment
There was a problem hiding this comment.
Looks good; thanks for the fix here! We'll keep an eye on the for now only use downstream:
https://github.com/openrewrite/rewrite-testing-frameworks/blob/366deb6292a0e17daf021268e5acfc7550ce859f/src/main/resources/META-INF/rewrite/junit5.yml#L136-L146
What's changed?
Reworked the visitor for
DoesNotIncludeDependency(both versions) so that it will first check that the file would have been accepted byDependencyInsight's visitor before trying to visit it, and then only if an acceptable file was not marked, will it return a found result with that file in it.What's your motivation?
Previously there was a bug wherein if you applied
DoesNotIncludeDependencyto a file of a conceptually inapplicable type (i.e. a Java or Gradle file for the Maven version or a Java or POM file for the Gradle version), it would end up marking the file because the visitor forDependencyInsightin each case was being run through the preconditionnot.Checklist