title: How to avoid NPE due to lombok @Data annotation in a class with final field?
body: <p>I'm getting null pointer exception caused by:</p>
  <pre><code>Caused by: java.lang.UnsupportedOperationException: No accessor to set property private final java.lang.String
  </code></pre>
  <p>After some research, I realized that it's happening because my class is annotated with @Data and I have a final field defined within it.</p>
  <pre><code>@Data
  @Builder
  public class ClassA {
      private String id;
  
      private final String name = &quot;Name A&quot;;
  }
  </code></pre>
  <p>I'm creating objects of ClassA here:</p>
  <pre><code>public ClassA converter(InputData input) {
       if (input == null || input.getIdValue() == null) {
           return null;
       }
          
       return ClassA.builder()
                 .id(input.getIdValue())
                 .build();
  }
  </code></pre>
  <p>Any suggestion on how to handle this problem?</p>