Lombok seems not properly supported or something?
When running the following program:
import lombok.AllArgsConstructor;
// other imports omitted
public class Main {
@AllArgsConstructor
private enum Gesture {
ROCK(1, "A", "X"),
PAPER(2, "B", "Y"),
SCISSOR(3, "C", "Z");
private int score;
private String opponentGlyph;
private String ownGlyph;
// methods omitted
}
public static void main(String[] args) {
// omitted, uses the Gesture enum
}
// extracted methods omitted
}
the compiler throws an error that the constructor requires 0 arguments, even though Lombok should generate a 3-argument constructor. Did someone observe a similar issue before? I guess one workaround would be simply not using Lombok. Any other ideas?
2 Answers
3 years ago by Egor Hans
@Egor Hans
- Have you added the
lombokdependency? - Can you provide the link to the code? So that it's easy to see how you are using
3 years ago by Karthik Divi
org.projectlombok:lombok:1.18.24 is listed as a compileOnly dependency. Code is at https://onecompiler.com/java/3yqp8pms4 (spoilers for today's Advent of Coding), but I delomboked it by now. My plan was to have Lombok generate the enum constructors using @AllArgsConstructor.
3 years ago by Egor Hans