Handle Map.Entry
properly in import removal, and remove duplicated logic
#390
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.
Prior to this PR, there were two pieces of code in Specimin that were both trying to handle removing extraneous imports:
PrunerVisitor
, andUnusedImportRemoverVisitor
classI deleted the logic in
PrunerVisitor
, which was more complex but had the same overall impact. I enhanced the logic inUnusedImportRemoverVisitor
to fix the bug evinced by the new test case, wherein theimport java.util.Map
was incorrectly removed. I also had to add somecontinue
statements elsewhere inPrunerVisitor
; that part makes me nervous, because a seemingly-unrelated test failed without them but did not fail until I removed the logic inPrunerVisitor
. However, I much prefer this design and don't have time to dig deep into that, so I'm okay with ignoring that weirdness for now: the newcontinue
statements are pretty clearly correct (it's not sensible to keep going through the loop body's logic if we've already decided to remove something).I expect CI to fail, because this PR should resolve some compilation issues in plume-util. I'll update the "passed" baseline number once I know what the new result is.