2

I have added Lombok annotation(@NoArgsConstructor and @AllArgsConstructor) for my following object:

package com.example.demo.student;

import lombok.*;

@ToString
@Getter
@Setter
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
public class Student {
    private Long id;
    private String name;
    private String email;
    private Gender gender;
}

The code can be compiled and the application can be run without any issue.

However, the IntelliJ still shows warning red lines about creating constructor like the following screenshot.

Can't IntelliJ recognize Lombok annotations?

Is there any way to stop IntelliJ showing such warning messages?

My IDE version is IntelliJ IDEA 2019.3.3 (Ultimate Edition)

enter image description here

theedchen
  • 1,564
  • 4
  • 10
  • 17
  • 4
    See for Lombok plugin for intellij – Barracuda Jan 19 '22 at 13:43
  • 1
    You need the lombok plugin so that IDEA recognizes that the annotations will result in generated code. – f1sh Jan 19 '22 at 13:45
  • Does this answer your question? [Can't compile project when I'm using Lombok under IntelliJ IDEA](https://stackoverflow.com/questions/9424364/cant-compile-project-when-im-using-lombok-under-intellij-idea) – magicmn Jan 19 '22 at 13:56
  • @magicmn I think my question is much simpler than that. And actually I just solved it by installing the plugin as suggested. Thank you all! =D – theedchen Jan 19 '22 at 14:00

1 Answers1

2

I solved it after installed the Lombok plugin for my IntelliJ.

Here is how I did:

  1. Go to File > Settings > Plugins .
  2. Then search "Lombok" and install the plugin.
  3. Restart the IntelliJ and the warning message disappeared.

Thanks for @Barracuda and @f1sh propmpt answer !!

theedchen
  • 1,564
  • 4
  • 10
  • 17