rewrite-migrate-java
rewrite-migrate-java copied to clipboard
`LombokValueToRecord` should rewrite method references too
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
That there isn't any method type in that case sounds like a bug in the Java parser to me.
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
.
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?
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.
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.