Skip to content

Duplicate method error with @Delegate #69

@fnumrich

Description

@fnumrich

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions