Skip to content

Preserve raw cast on parameterized expression in RemoveRedundantTypeCast#905

Merged
timtebeek merged 1 commit into
mainfrom
tim/issue-901
May 27, 2026
Merged

Preserve raw cast on parameterized expression in RemoveRedundantTypeCast#905
timtebeek merged 1 commit into
mainfrom
tim/issue-901

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented May 27, 2026

Summary

Test plan

  • New test doNotRemoveRawCastBridgingWildcardCapture reproducing the issue
  • Existing RemoveRedundantTypeCastTest suite still passes
  • Full ./gradlew test passes

…Cast`

A raw cast like `(B) b` where `b` is `B<T>` is an intentional unchecked
conversion; removing it changes overload and type-inference behavior
when the receiver is itself parameterized (e.g. `I<? extends T>`).
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite May 27, 2026
@timtebeek timtebeek marked this pull request as ready for review May 27, 2026 08:06
@timtebeek timtebeek merged commit e4bcb09 into main May 27, 2026
1 check passed
@timtebeek timtebeek deleted the tim/issue-901 branch May 27, 2026 08:20
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

RemoveRedundantTypeCast removes necessary Cast in Case when Generics are used

1 participant