Skip to content

Conversation

@joanvr
Copy link
Contributor

@joanvr joanvr commented Oct 24, 2023

What's changed?

We need to cast the lambda expression, when we have some unbounded generics on it's body. Right now I'm trying to identify those by searching for method invocations of methods with arguments with parametrized types with generics, but this just narrows it a bit, but those generics not necessarily are unbounded without the explicit cast.

Also, changed the methodArgumentRequiresCast and previous check to accept MethodCall instead of J.MethodInvocation, so we can also reuse it for J.NewClass too

What's your motivation?

Fixes https://github.com/moderneinc/support-app/issues/17

Anything in particular you'd like reviewers to focus on?

How we can detect better when it's needed to add the cast and when it's redundant?

Checklist

  • I've added unit tests to cover both positive and negative cases

@joanvr joanvr marked this pull request as draft October 24, 2023 11:01
@timtebeek timtebeek added the bug Something isn't working label Oct 24, 2023
@knutwannheden knutwannheden marked this pull request as ready for review November 7, 2023 09:26
@joanvr joanvr merged commit 30d61b6 into main Nov 8, 2023
@joanvr joanvr deleted the fix/cast-lambda-generics branch November 8, 2023 08:32
Copy link
Contributor

@knutwannheden knutwannheden left a comment

Choose a reason for hiding this comment

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

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants