Repository navigation
Fixes Mockito getting PowerMock's version from parent pom properties and Gradle version variables - #1198
Merged
Conversation
β¦and Gradle version variables
timtebeek
reviewed
Oct 19, 2026
Comment on lines
+62
to
+68
| for (String powerMockArtifact : Arrays.asList("powermock-api-mockito", "powermock-api-mockito2")) { | ||
| for (String mockitoArtifact : Arrays.asList("mockito-core", "mockito-inline")) { | ||
| for (Boolean changeManagedDependency : Arrays.asList(null, false)) { | ||
| changeDependencies.add(new ChangeDependency( | ||
| "org.powermock", powerMockArtifact, | ||
| "org.mockito", mockitoArtifact, "3.x", | ||
| null, null, changeManagedDependency)); |
Member
There was a problem hiding this comment.
Not sure I fully follow this triple nested for loop, also considering we only seem to test one combination, but if you're confident feel free to merge.
I've rebased to fix the CI failure that might have held you back.
Member
Author
There was a problem hiding this comment.
Good call, innermost loop was not needed, can just set true always
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ReplacePowerMockDependenciescalledChangeDependency.getVisitor(), which gives the delegate an empty accumulator because its scanner never runs. As a result, a PowerMock version held in a parent pom property or a Gradle version variable was never updated. The dependency was renamed toorg.mockito:mockito-core:${powermock.version}, which resolves to a Mockito version that doesn't exist, such as 2.0.9.The recipe now:
ChangeDependencydelegates as fields and keeps their accumulators in its ownAccumulatorTests cover a version property inherited from a parent pom and a version variable from
gradle.properties.rewrite-propertiesis added as a test dependency for the second one.