Flag un-migratable PowerMock powermock-reflect usage with a comment#1016
Merged
Conversation
Wires org.openrewrite.java.AddCommentToMethodInvocations into ReplacePowerMockito after the Whitebox migration and before the PowerMock dependency removal, matching `org.powermock.reflect.Whitebox *(..)`. Any remaining Whitebox call with no faithful reflection equivalent (type-based get/setInternalState, newInstance, name-less invokeMethod, ...) gets an idempotent inline comment, so removing the dependency never silently leaves uncompilable code without a trace. Uses the existing declarative recipe rather than a bespoke one. Adds an end-to-end ReplacePowerMockitoIntegrationTest case (with powermock-reflect-1 on the classpath) proving migrate-and-flag together.
2762d71 to
787bd70
Compare
Member
|
Given the work we've done on this front in the past week, is there anything left to flag / do here? |
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.
Flags any
org.powermock.reflect.Whiteboxusage that the PowerMock → Mockito migration cannot rewrite, so removing thepowermock-reflectdependency never silently leaves uncompilable code without a trace.Rather than a bespoke recipe, this wires the existing declarative
org.openrewrite.java.AddCommentToMethodInvocationsintoReplacePowerMockito, after theWhiteboxmigration and before the PowerMock dependency removal:Any remaining
Whiteboxcall with no faithful reflection equivalent (type-basedgetInternalState/setInternalState,newInstance, the name-less "best guess"invokeMethod, …) gets an idempotent inline comment —AddCommentToMethodInvocationschecks for an existing identical comment before adding, so repeated migration cycles don't duplicate it.Adds an end-to-end
ReplacePowerMockitoIntegrationTestcase (withpowermock-reflect-1on the classpath) exercising migrate-and-flag through the fullReplacePowerMockitopipeline.