Can lombok decrease performance?

Report
Question

Please briefly explain why you feel this question should be reported .

Report Cancel

I am really enjoy the feature of project lombok that get rid of boilerplate code.
My senior suggest me that lombok seems to use reflection to reduce boilerplate code and I once heard that using of reflection effect performance.
My question is are there any issues to use project lombok?

solved 0
2 Answer 28 views 0

Answers ( 2 )

    13
    January 11, 2017 at 3:00 pm

    Please briefly explain why you feel this answer should be reported .

    Report Cancel

    Lombok does not use reflection at runtime. It hooks into the compiler internals and adds code to classes at compile-time, which is then compiled normally.

    Best answer
    4
    January 11, 2017 at 3:00 pm

    Please briefly explain why you feel this answer should be reported .

    Report Cancel

    @chrylis answer is correct, but be careful with objects graph (@Data and @ToString annotation) e.g.

    @Data 
    public class A {
       private B b;
    }
    
    @Data 
    public class B {
       private A a;
    }
    

    Lombok will create toString with infinite recursion inside. You should use
    something like @ToString(exclude = {"a"}) inside class B

Leave an answer

Browse

What is the capital of Egypt ? ( Cairo )

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>