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

@Builder.Default-annotated fields excluded as parameters for @RequiredArgsConstructor-generated constructors #1164

Open
hwaite opened this issue Dec 25, 2022 · 1 comment

Comments

@hwaite
Copy link

hwaite commented Dec 25, 2022

Short description

@RequiredArgsConstructor annotation generates a constructor that accepts parameters for all non-initialized members. Lombok plugin mistakenly recognizes fields with @Builder.Default annotation as initialized. From lombok-generated constructor's perspective, the @Builder.Default annotation invalidates inline initializations. IDEA 'Structure' pane shows constructor with missing parameters. Code relying on this 'false' constructor shows no errors. However, any code relying on the phantom constructor won't compile from javac.exe.

Expected behavior

IDEA should interpret class structure in the same way that compiler does.

Version information

  • IDEA Version: Build #IU-222.4459.24, built on November 22, 2022
  • JDK Version: openjdk version "17.0.2" 2022-01-18
  • OS Type & Version: Windows 11
  • Lombok Plugin Version: 222.4459.24
  • Lombok Dependency Version: 1.18.24

Steps to reproduce

What steps do we need to take to reproduce this issue?

@Value @Builder @RequiredArgsConstructor class Foo {
    String alpha;
    @Builder.Default
    String bravo = "x";
    static void bar() {new Foo("y");}
}
[ERROR] Foo.java:[10,29] constructor Foo in class Foo cannot be applied to given types;
[ERROR]   required: java.lang.String,java.lang.String
[ERROR]   found:    java.lang.String
[ERROR]   reason: actual and formal argument lists differ in length

missingparam

@hwaite
Copy link
Author

hwaite commented Dec 25, 2022

See also #1110 and #1123.

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

No branches or pull requests

1 participant