Assume the following classes - since these are simplified examples they make no sense and there would be better ways for the type attribute.
But in our real scenario it has to be done this way ...
@Data
public class Vehicle {
private final String type = "VEHICLE";
}
@Data
public class DelegatingVehicle extends Vehicle {
private final String type = "DELEGATING_VEHICLE";
@Delegate
private Vehicle delegate;
}
For the DelegatingVehicle class the following is generated by lombok:
@Data creates the getType() method
@Delegate also creates a getType() method that delegates to delegate.getType()
So we get the error Duplicate method getType() in type DelegatingVehicle.
Yes, I know that @Delegate is experimental - but wait ...
- Compiling the code using gradle works without an error
- Using IntelliJ with the lombok plugin this works without an error
It seems to be a problem of the vscode-lombok extension, since it's the only 'one' that reports this error.