Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LombokValueToRecord should rewrite method references too #469

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

holgpar
Copy link
Contributor

@holgpar holgpar commented May 1, 2024

Unfortunately, J.MemberReference does not have a methodType when
the member reference is through an object.

When it is throught a class (to a static method) it works as expected...

What's changed?

What's your motivation?

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

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@knutwannheden
Copy link
Contributor

knutwannheden commented May 1, 2024

That there isn't any method type in that case sounds like a bug in the Java parser to me.

@timtebeek timtebeek added the enhancement New feature or request label May 2, 2024
@timtebeek timtebeek changed the title try to rewrite method references LombokValueToRecord should rewrite method references too May 2, 2024
@timtebeek timtebeek added the bug Something isn't working label May 2, 2024
@timtebeek
Copy link
Contributor

Can we separate these cases into separate tests to get these changes partially through already? Then we can separately work on the type issues, with the failing test here marked as @ExpectedToFail.

@holgpar
Copy link
Contributor Author

holgpar commented May 2, 2024

hm... at the moment we cannot do a meaningful implementation that addresses method references.
So are you asking for a test case to reproduce the issue?

@timtebeek
Copy link
Contributor

Ah no I'd thought from your message above that it does work for ClassName::methodName, but not for someInstance::methodName, and as such that we can at the very least try to cover the first case already, and add a separate unit test for the second case annotated with @ExpectedToFail (or @Disabled). If I misunderstood then please ignore; we'll need that proper fix anyway as well.

@holgpar
Copy link
Contributor Author

holgpar commented May 2, 2024

I just mentioned the static case to give you guys a clue on what might be wrong... It does not help for this recipe. Sorry for causing confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants