Questions tagged [lombok]

Project Lombok is a tool for reducing boilerplate code in Java through annotations and compile time code generation.

The details for project Lombok can be found at http://projectlombok.org/.

The primary functionality of Lombok is reducing the boilerplate code in JavaBeans by replacing all setters, getters, equals, hashCode and toString with a single @Data annotation on the class.

Many other useful features are offered and the project is under active development.

2384 questions
71
votes
10 answers

IntelliJ IDEA cannot see Lombok generated code

I have a Gradle-based project that uses lombok. I have imported this project into IntelliJ IDEA 14.1 (using the Import External Model import method). I can run the JUnit4 unit tests without problem in Gradle, but IntelliJ seems to have a problem…
copolii
  • 14,208
  • 10
  • 51
  • 80
67
votes
1 answer

Lombok Private Constructor

Is there any annotation available for Lombok private NoArgConstructor? Lombok @NoArgConstructor creates a public Constructor with no parameter. But I want private constructor annotation.
emon
  • 1,629
  • 1
  • 17
  • 18
62
votes
28 answers

Lombok problems with Eclipse Oxygen

I upgraded recently to the new Eclipse version (Oxygen). I downloaded the lombok.jar from the website and installed it. This is how the eclipse.ini looks like after…
Alex P.
  • 3,073
  • 3
  • 22
  • 33
62
votes
2 answers

Lombok @Builder not initializing collections

I am using Lombok's @Data and @Builder annotations like this: @Data @Builder(toBuilder = true) class Movie { // Some other fields here. private final List actors; } When I create a new Movie using the builder, without specifying…
marstran
  • 26,413
  • 5
  • 61
  • 67
61
votes
9 answers

ObjectMapper can't deserialize without default constructor after upgrade to Spring Boot 2

I have following DTOs: @Value public class PracticeResults { @NotNull Map wordAnswers; } @Value public class ProfileMetaDto { @NotEmpty String name; @Email String email; @Size(min = 5) String…
solomkinmv
  • 1,804
  • 3
  • 19
  • 30
61
votes
3 answers

Lombok annotation @Getter for boolean field

I am using Java lombok annotation @Getter to generate getters for my POJO. I have a boolean field by the name isAbc. The @Getter annotation in this case generates a method by the name isAbc(). Shouldn't it generate a method by the name isIsAbc()?
Nitesh Kumar
  • 789
  • 1
  • 5
  • 11
60
votes
10 answers

Adding Lombok plugin to IntelliJ project

I'm trying to add Lombok to my Spring Boot project in IntelliJ IDEA. So far, I've added the plugin under Settings - Plugins (version 0.13.16) added compile('org.projectlombok:lombok') to my Gradle dependencies enabled annotation processing It…
Anders Pedersen
  • 2,255
  • 4
  • 25
  • 49
59
votes
4 answers

Lombok plugin incompatible with 2018.1 Intellij Idea

Right now I have seen Intellij Idea update window with the notion: Plugin incompatible with new build found: Lombok Plugin Is there a way to solve the problem or I should wait till lombok plugin team resolved the compatibility issues?
Loom
  • 9,768
  • 22
  • 60
  • 112
58
votes
4 answers

JaCoCo: exclude generated methods (using it with Lombok)

I am using JaCoCo and it is considering methods generated by Lombok (generated in the bytecode, not trace of them in the source code). How can I configure JaCoCo to ignore them?
Federico Tomassetti
  • 2,100
  • 1
  • 19
  • 26
58
votes
3 answers

Error: package javax.annotation does not exist after upgrade to lombok 1.16.2

My android project builds fine with lombok 1.16.0, but once I change my dependency to target 1.16.2, I get the following error everywhere I'm using a lombok annotation: Error:(20, 1) error: package javax.annotation does not exist The Android SDK…
copolii
  • 14,208
  • 10
  • 51
  • 80
56
votes
3 answers

Lombok causing "Actual and formal arguments lists differ in length error"

I have the following class: @Builder @NoArgsConstructor public class ConsultationPointOfContact { private String fullName; private String phoneNumber; private String userLogin; } When the @Builder annotation exists, it is causing…
Menelaos
  • 23,508
  • 18
  • 90
  • 155
56
votes
1 answer

Optional in Lombok

I have a class called Address which looks like this: @Value class Address { @NotNull String userId; @NotNull String line1; String line2; private Address(Builder b) { // copy everything from builder } // override getter for…
Dhrumil Upadhyaya
  • 1,014
  • 2
  • 10
  • 14
55
votes
2 answers

Best practice for @Value fields, Lombok, and Constructor Injection?

I'm developing a Java Spring application. I have some fields in my application which are configured using a .yml config file. I would like to import those values using an @Value annotation on the fields in question. I would also like to use the…
Ertai87
  • 1,156
  • 1
  • 15
  • 26
53
votes
16 answers

how to configure lombok in eclipse luna

I configure lombok in eclipse Luna with Maven. Annotation is added properly, but no getter and setter are generated. eclipse.ini `-vm E:\Program Files\Java\jdk1.7.0_60\bin` `-vmargs` `-Dosgi.requiredJavaVersion=1.7` `-javaagent:F:\Tools\Java…
alokj
  • 759
  • 1
  • 6
  • 13
51
votes
5 answers

sonarqube + lombok = false positives

import lombok.Data; @Data public class Filter { private Operator operator; private Object value; private String property; private PropertyType propertyType; } For code above there are 4 squid:S1068 reports about unused private…
okutane
  • 13,754
  • 10
  • 59
  • 67