Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

static import not working in lombok builder in intelliJ

I am using Lombok in IntelliJ. Though everything else is working fine when I try to do the static import of the Lombok builder, IntelliJ build project doesn't find the builder class. If you don't use static import, it works fine.

like image 758
krmanish007 Avatar asked Dec 06 '17 12:12

krmanish007


People also ask

How import static method in IntelliJ?

press Ctrl+Shift+M to bring up the context action "Add static import for ..." option.

Can static method be imported?

Static import is a feature introduced in the Java programming language that allows members (fields and methods) which have been scoped within their container class as public static , to be used in Java code without specifying the class in which the field has been defined.

What is @builder annotation in Lombok?

Project Lombok's @Builder is a helpful mechanism for using the Builder pattern without writing boilerplate code. We can apply this annotation to a Class or a method. In this quick tutorial, we'll look at the different use cases for @Builder.


1 Answers

This is a known bug, and not something that's easy to fix. Static imports are resolved before the annotation processors are run. This is a problem in javac, not lombok.

Disclosure: I am a lombok developer.

like image 66
Roel Spilker Avatar answered Oct 04 '22 21:10

Roel Spilker