Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] @Delegate does not work properly with records in Eclipse #3830

Open
danielerepici opened this issue Feb 19, 2025 · 1 comment · May be fixed by #3831
Open

[BUG] @Delegate does not work properly with records in Eclipse #3830

danielerepici opened this issue Feb 19, 2025 · 1 comment · May be fixed by #3831
Assignees

Comments

@danielerepici
Copy link

danielerepici commented Feb 19, 2025

Describe the bug
@Delegate annotation on a java record's field fails to be copied to the generated class in Eclipse.

To Reproduce

// Bob.java
public class Bob {
  public String getStuff() {
    return "stuff";
  }
}

// BetterBob.java
public record BetterBob(@Delegate Bob bob) {}

// Main Code
public class BobApp {
  public static void main(String[] args) {
    BetterBob bb = new BetterBob(new Bob());
    bb.getStuff(); // <-- The method getStuff() is undefined for the type BetterBob
  }
}

Expected behavior
Methods of the delegate class become available in the delegating record.

Version info (please complete the following information):

  • Lombok version: 1.18.36
  • Platform: Eclipse Version: 2024-12 (4.34.0) - Build id: 20241128-0757

Additional context
Related SO question

@Rawi01 Rawi01 self-assigned this Feb 19, 2025
Rawi01 added a commit to Rawi01/lombok that referenced this issue Feb 19, 2025
@Rawi01 Rawi01 linked a pull request Feb 19, 2025 that will close this issue
@tomakami
Copy link

tomakami commented Feb 21, 2025

Hey, I got similar issue on VS Code when I use Delegate on record nested in another record. Not sure if this deserver separate issue, so just bumping this one

Version info:

  • Lombok version: 1.18.36
  • Platform: Cursor 0.45.15 (VSCode Version 1.96.2)

Description:
Delegate methods are not available if delegated record is inside another record (so example is the same as in author's code, just that Bob is a record too). After I changed external record(BetterBob in code example) to class it worked (so it was class containing delegated record)
Same code on IntelliJ IDEA works without any errors

LMK if this description is enough or should I create separate issue for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants