Search code examples
androidlombokintellij-lombok-plugin

Lombok - @Singular annotation not found


I am using Lombok for one of my apps.

I have a class declared with the annotation @Builder. The fields are annotated with @SerializedName("xxxxx") in order to support Gson.

However, one of the fields is a List so I would like to use the @Singular annotation for them, but looks like the lib doesn't know about this annotation.

@Builder 
public class ProductForm {
   @SerializedName("title") private String title;
   @SerializedName("description") private String description;
   @SerializedName("images") private List<ImageForm> imageFormList;
   @SerializedName("active") private boolean active;
}

Does anyone know why?

Doc here


Solution

  • Using lombok 1.16.4 and your code (used @lombok.Builder not the deprecated one) I've no compile error when adding @lombok.Singular to imageFormList in your code.

    So you probably forgot to import @lombok.Singular or used an old version of lombok.