Conversation
634b92d to
75a028a
Compare
For uses cases such as Lombok, allow `@DeconstructorAccessor` on fields and search for a matching getter to use as the accessor. Additionally, refine ordering rules for generated records. The default is now encounter order. Closes #264
75a028a to
f6e05da
Compare
|
@Randgalt This will only work if the get method is hardcoded, it will not catch the method that will be generated.
|
|
@Srdjan-V how do I create an example that has "generated" methods? |
|
@Randgalt you'd have to decompile the bytecode. import lombok.Getter;
@Getter
public class MyClass {
private final int qty;
private final String name;
private MyClass(int qty, String name) {
this.qty = qty;
this.name = name;
}
// etc.
}//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
import lombok.Generated;
public class MyClass {
private final int qty;
private final String name;
private MyClass(int qty, String name) {
this.qty = qty;
this.name = name;
}
@Generated
public int getQty() {
return this.qty;
}
@Generated
public String getName() {
return this.name;
}
} |
|
Hmm - I'm not following. I have tests in this PR that work correctly and find the generated methods. What's wrong here? |
|
I'm guessing that the Deconstructor processor is running before the Lombok one in my case. I'm also using Gradle and its plugin for Lombok. |
|
I changed the order of processors and it fails as you see. However, it's not possible to access |
|
From what I can tell, And it's not too much to require, but I will need to investigate why it's doing it in this order. I will write once I find out more. |
|
The plugin was using |
|
@Srdjan-V shall we merge this then? |
|
Yeah it's fine. But It would also be nice for the deconstructor to auto find the methods, that might be to much though. |
I'm not sure how. Any ideas? |
|
It has the logic of finding methods, adding an option to the @Deconstructor(autoFindAccessors = true)
@Getter
public class MyClass {
private final int qty;
private final String name;
private MyClass(int qty, String name) {
this.qty = qty;
this.name = name;
}
// etc.
} |
|
The problem is naming. We'd need to add additional settings to manage |
|
No problem. This can be merged. |


For uses cases such as Lombok, allow
@DeconstructorAccessoron fields and search for a matching getter to use as the accessor.Additionally, refine ordering rules for generated records. The default
is now encounter order.
Closes #264
cc @Srdjan-V - please test