You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
This seems to be a regression as I never had this problem on IntelliJ 2020.1.x:
When a class has both a @builder and a @XArgsConstructor, the builder should not try to create a constructor but use the one from the explicit annotation. However, when combining them, intellij now sees the generated constructor as package-private instead of public.
The code works correctly when compiled using gradle, so it seems to be an IntelliJ plugin problem.
If a member is annotated, it must be either a constructor or a method. If a class is annotated, then a private constructor is generated with all fields as arguments (as if @AllArgsConstructor(access = AccessLevel.PRIVATE) is present on the class), and it is as if this constructor has been annotated with @builder instead. Note that this constructor is only generated if you haven't written any constructors and also haven't added any explicit @XArgsConstructor annotations.
Expected behavior
The constructor should be generated with all rules of @XArgsConstructor, thus be public by default and honor the access property.
Version information
IDEA Version: IntelliJ IDEA 2020.2.1 (Ultimate Edition)
JDK Version: AdoptOpenJDK 11.0.8
OS Type & Version: Windows 10 Pro x64
Lombok Plugin Version: 0.30-EAP
Lombok Dependency Version: 1.18.12
Steps to reproduce
Create the following class in IntelliJ:
@NoArgsConstructor
@Builder
public class Test {
}
Watch it in the Structure view
It says, it has 3 no-args constructors, all package-private instead of public.
Adding an access=PUBLIC or any other level changes nothing
The text was updated successfully, but these errors were encountered:
Reproduced on IntelliJ IDEA 2020.2.2 (Ultimate Edition) on MacOS 10.15.16. Re-installing the plugin and invalidating IDEA cache helps resolves this until next IDEA restart.
Short description
This seems to be a regression as I never had this problem on IntelliJ 2020.1.x:
When a class has both a @builder and a @XArgsConstructor, the builder should not try to create a constructor but use the one from the explicit annotation. However, when combining them, intellij now sees the generated constructor as package-private instead of public.
The code works correctly when compiled using gradle, so it seems to be an IntelliJ plugin problem.
The doc of @builder is also clear about this:
Expected behavior
The constructor should be generated with all rules of @XArgsConstructor, thus be public by default and honor the access property.
Version information
Steps to reproduce
The text was updated successfully, but these errors were encountered: