Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

annotation with my enum, it doesn't recognise the constructor, enum throws and error that it cannot take string argument.

How to resolve this?

import lombok.Getter;
import lombok.AllArgsConstructor
@AllArgsConstructor
public enum Direction {
    NORTH("NORTH"), // all these enums give error, for no constructor
    SOUTH("SOUTH"),
    EAST("EAST"),
    WEST("WEST");
    @Getter private String value;

P.S.: I am using intellij-idea, which has lombok plugin install. My lombok dependency version is: 1.16.20

I works just fine for me with Lombok 1.16.20. There may be a problem with the lombok install in IntelliJ. Try to do something else with Lombok in a non-enum, if that doesn't work either, it's certain to be an installation issue – Erwin Bolwidt Apr 15, 2018 at 3:26 Can you show the code that doesn't work (rather than the code that does work as you've posted now) ? Then we can see what might be wrong. – Erwin Bolwidt Apr 15, 2018 at 3:31 The only problem with the code that you posted is the missing semicolon in your second import statement. Change import lombok.AllArgsConstructor to import lombok.AllArgsConstructor;. After that, your code works just file, both from the maven command line (in a maven project) and in Eclipse. – Erwin Bolwidt Apr 15, 2018 at 5:45

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.