Issue
I have a simple object:
@Value
@Builder
public class User implements Serializable {
private final String userId;
private final String email;
private final String name;
}
No magic here except the fact that im using Lombok 1.18.2
here for the @Value
and @Builder
Annotations. All was working fine with Java 10 and Gradle 4.10. Now I upgraded to Java 11 and Gradle 5.2 and suddenly I get:
> Task :application:compileJava
/src/application/src/main/java/com/rbb/tutor/user/model/User.java:12: error: variable userId not initialized in the default constructor
private final String userId;
^
/src/application/src/main/java/com/rbb/tutor/user/model/User.java:13: error: variable email not initialized in the default constructor
private final String email;
^
/src/application/src/main/java/com/rbb/tutor/user/model/User.java:14: error: variable name not initialized in the default constructor
private final String name;
^
I dont really know what to do here. First I thought it is a problem with lombok but I upgraded to 1.18.6
which supports java 11. Now I have no new idea whats wrong.
Solution
In gradle 5, you need to list annotation processors separately. Maybe that's the problem?
An example gradle build can be found here:
https://projectlombok.org/setup/gradle
Answered By - rzwitserloot
Answer Checked By - David Goodson (JavaFixing Volunteer)