Skip to content

Conversation

JohannisK
Copy link
Contributor

What's changed?

Added support for generic instanceof checks in AssertTrueInstanceofToAssertInstanceOf recipe

What's your motivation?

The recipe threw parsing errors.

Have you considered any alternatives or workarounds?

I've changed the recipe to support assertTrue(list instanceof List<?>); and change it to assertInstanceOf(List.class, list);.

Another option would be to ignore the breaking instance check, but I don't think the generic has any functional meaning.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions could not be made:

  • src/main/resources/META-INF/rewrite/examples.yml
    • lines 1535-1535
    • lines 1817-1817
    • lines 1825-1825
    • lines 2251-2251
    • lines 2265-2265
    • lines 2443-2503
    • lines 2576-2575

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite May 20, 2025
@timtebeek timtebeek added bug Something isn't working assertj junit and removed assertj labels May 20, 2025
@JohannisK JohannisK merged commit e969a22 into main May 20, 2025
2 checks passed
@JohannisK JohannisK deleted the 5448-parsing-failed-on-assertionsasserttrueo-instanceof-abstractlist branch May 20, 2025 10:47
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working junit
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Parsing failed on Assertions.assertTrue(o instanceof AbstractList<?>);
2 participants