FAQ Database Discussion Community


How to get org.mangosdk.spi.ProviderFor dependency for writing a custom Lombok transformation?

java,maven,lombok
I am writing a Lombok custom transformation, but I am stuck because Lombok handlers require using org.mangosdk.spi.ProviderFor annotation, and I can't find it in the Maven repositories. How are you supposed to get that dependency when making a custom Lombok transformation? I tried looking at how that dependency is retrieved...

Jackson deserialization circumventing final fields

java,json,jackson,immutability,lombok
Here's the code import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.Data; import lombok.ToString; public class Main { public static void main(String[] args) throws Exception { Fields f1 = new Fields(1); System.out.println(f1); ObjectMapper mapper = new ObjectMapper(); String str = mapper.writeValueAsString(f1); System.out.println(str); Fields f2 = mapper.readValue(str, Fields.class); System.out.println(f2); } @Data @ToString public static...

Required arguments with a lombok @Builder

java,lombok
If I add @Builder to a class. The builder method is created. Person.builder().name("john").surname("Smith").build(); I have a requirement where a particular field is required. In this case, the name field is required but the surname is not. Ideally, I would like to declare it like so. Person.builder("john").surname("Smith").build() I can't work out...

SonarQube Lombok Getter recognition

sonarqube,lombok,sonarqube-4.5
I am using SonarQube 4.5.4 with java plugin 3.1. As I know this sonar-java version supports lombok partially (Getter and Setter annotations) starting from 2.8 (http://jira.codehaus.org/browse/SONARJAVA-73). But in my case it still reports field with lombok.Getter as squid:S1068 Unused private fields should be removed: @Getter private String userName; Do you...

Lombok and Maven

java,maven,intellij-idea,lombok
I'm trying to use Lombok with Maven and VRaptor on IntelliJ but it doesn't work. I already read some info in stackoverflow but none solved my problem, i already enabled the Annotation Processor in Intellij but still nothing. I tryied to compile it from command-line too (Windows) and didn't work....

Lombok exclude property from builder

java,builder,lombok
I have a class called as "XYZClientWrapper" , which have following structure: @Builder XYZClientWrapper{ String name; String domain; XYZClient client; } What I want no build function generated for property "XYZClient client;" Does Lombok supports such use case?...

Error: package javax.annotation does not exist after upgrade to lombok 1.16.2

java,android,lombok,intellij-lombok-plugin
My android project builds fine with lombok 1.16.0, but once I change my dependency to target 1.16.2, I get the following error everywhere I'm using a lombok annotation: Error:(20, 1) error: package javax.annotation does not exist The Android SDK does not include all javax packages. What I'm wondering is if...

lombok-1.14.6.jar error the method getDob() is undefined for the type ***

java,lombok
I have added lombok-1.14.6 in my eclipse (helios) for my application. I am getting the error for all get methods. Like The method getSex() is undefined for the type *** The method getSex() is undefined for the type *** I have added lombok jar file in eclipse. I don't know...

Lombok inheritance with @EqualsAndHashCode

java,java-8,lombok
I have a class which extends a parent class using @EqualsAndHashCode. I am getting a compilation error with Lombok 1.16.0 and Java 8 @EqualsAndHashCode(doNotUseGetters = true, of = { "propertyA", "propertyB" }) public class Parent {...} @EqualsAndHashCode(callSuper = true, doNotUseGetters = true, of = { "propertyC", "propertyD" }) public class...

Fluent getters generate errors

java,intellij-idea,lombok,intellij-14,intellij-lombok-plugin
I have a project with the following lombok.config file: lombok.accessors.chain = true lombok.accessors.fluent = true So the following class should compile fine: @Data class A { private int i; public static void main(String[] args) { new A().i(); } } and it does when compiling with javac. But Intellij (with or...

Delombok Java 8 Type Annotations

maven,maven-plugin,lombok,type-annotation
I am working on a Java 8 Spring project and wanted to use Lombok to reduce boilerplate code. Since I need a Javadoc, I set up the lombok-maven-plugin and the maven-javadoc-plugin. After running the lombok:delombok goal the source is generated to target/generated-sources/delombok, as I specified it. But the code is...

IntelliJ IDEA cannot see Lombok generated code

java,intellij-idea,junit4,lombok,intellij-lombok-plugin
I have a Gradle-based project that uses lombok. I have imported this project into IntelliJ IDEA 14.1 (using the Import External Model import method). I can run the JUnit4 unit tests without problem in Gradle, but IntelliJ seems to have a problem seeing the Lombok generated Getters. This is preventing...

Spring + Lombok: Can I have @Autowired @Setter

spring,lombok
class Foo { @Setter @Autowired private Bar bar; } Spring will use field injection here. Is there currently any way of telling it to use a setter injection?...

Lombok - maven compilation failure “error: cannot access MappedSuperClass”

java,maven,lombok
I started using project lombok and noticed that command line compilation from maven fails on a clean compile. Code compiles under eclipse though. I have lombok dependency in my POM as specified. [INFO] Spring, Axon, Spring security, REST API, Websockets SUCCESS [0.300s] [INFO] springagain-contracts ............................. SUCCESS [1.881s] [INFO] springagain-engine ...................................