Below is a small workaround for refactoring a getter / setter variable in the @Data class. This works in an eclipse and possibly elsewhere:
An example of a class where we want to rearrange "value" to "value2":
import lombok.Data; @Data public class Thing { int value; }
(1) Rename (do not refactor) this variable to a temporary location to delete the created lombak getter / setter for the original name. You will get compilation errors wherever the old getter / setter was specified, but this is temporary:
@Data public class Thing { int valueXXX;
(2) Manually create a dummy getter / setter for the old name. Now your compilation errors will disappear:
@Data public class Thing { int valueXXX; public int getValue() { return 0; } public void setValue(int value) {} }
(3) Use eclipse to refactor your dummy getter / setter. All links in your codebase now use getValue2 () and setValue2 ():
@Data public class Thing { int valueXXX;
(4) Remove the renamed dummy getter / setter and change the variable name from your temporary name to a new one. Now everything breaks down again:
@Data public class Thing { int value2; }
Admittedly, this is a little annoying, but it's not really that long, and he is confident that he will manage to change hundreds of links manually.
source share