aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Rieke <it@janrieke.de>2020-03-05 16:25:09 +0100
committerJan Rieke <it@janrieke.de>2020-03-05 16:25:09 +0100
commita749bc230f4e42904dc6803841cfb928c394d3b5 (patch)
tree5fd2aa3b4f2fc01396ebfdc5fe13ef16141faba9
parent8be4b0ffe6b5e5f89e8bb3d94e87d0aa98dc5aeb (diff)
downloadlombok-a749bc230f4e42904dc6803841cfb928c394d3b5.tar.gz
lombok-a749bc230f4e42904dc6803841cfb928c394d3b5.tar.bz2
lombok-a749bc230f4e42904dc6803841cfb928c394d3b5.zip
@Jacksonized: add flag usage configuration key
-rw-r--r--src/core/lombok/ConfigurationKeys.java9
-rw-r--r--src/core/lombok/eclipse/handlers/HandleJacksonized.java3
-rw-r--r--src/core/lombok/extern/jackson/Jacksonized.java10
-rw-r--r--src/core/lombok/javac/handlers/HandleJacksonized.java3
4 files changed, 20 insertions, 5 deletions
diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java
index 8a028858..46cf7412 100644
--- a/src/core/lombok/ConfigurationKeys.java
+++ b/src/core/lombok/ConfigurationKeys.java
@@ -651,6 +651,15 @@ public class ConfigurationKeys {
* If set, <em>any</em> usage of {@code @WithBy} results in a warning / error.
*/
public static final ConfigurationKey<FlagUsageType> WITHBY_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.withBy.flagUsage", "Emit a warning or error if @WithBy is used.") {};
+
+ // ----- Jacksonized -----
+
+ /**
+ * lombok configuration: {@code lombok.jacksonized.flagUsage} = {@code WARNING} | {@code ERROR}.
+ *
+ * If set, <em>any</em> usage of {@code @Jacksonized} results in a warning / error.
+ */
+ public static final ConfigurationKey<FlagUsageType> JACKSONIZED_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.jacksonized.flagUsage", "Emit a warning or error if @Jacksonized is used.") {};
// ----- Configuration System -----
diff --git a/src/core/lombok/eclipse/handlers/HandleJacksonized.java b/src/core/lombok/eclipse/handlers/HandleJacksonized.java
index 8d1ffb04..90ee7582 100644
--- a/src/core/lombok/eclipse/handlers/HandleJacksonized.java
+++ b/src/core/lombok/eclipse/handlers/HandleJacksonized.java
@@ -21,6 +21,7 @@
*/
package lombok.eclipse.handlers;
+import static lombok.core.handlers.HandlerUtil.handleExperimentalFlagUsage;
import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
import java.util.ArrayList;
@@ -62,6 +63,8 @@ public class HandleJacksonized extends EclipseAnnotationHandler<Jacksonized> {
private static final char[][] JSON_DESERIALIZE_ANNOTATION = Eclipse.fromQualifiedName("com.fasterxml.jackson.databind.annotation.JsonDeserialize");
@Override public void handle(AnnotationValues<Jacksonized> annotation, Annotation ast, EclipseNode annotationNode) {
+ handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.JACKSONIZED_FLAG_USAGE, "@Jacksonized");
+
EclipseNode annotatedNode = annotationNode.up();
EclipseNode tdNode;
diff --git a/src/core/lombok/extern/jackson/Jacksonized.java b/src/core/lombok/extern/jackson/Jacksonized.java
index 0f98cb33..cf6678da 100644
--- a/src/core/lombok/extern/jackson/Jacksonized.java
+++ b/src/core/lombok/extern/jackson/Jacksonized.java
@@ -41,20 +41,20 @@ import lombok.experimental.SuperBuilder;
* In particular, the annotation does the following:
* <ul>
* <li>Configure Jackson to use the builder for deserialization using
- * {@code @JsonDeserialize(builder=MyClass.MyClassBuilder[Impl].class))} on the
- * class. (An error is emitted if such an annotation already exists.)
+ * {@code @JsonDeserialize(builder=Foobar.FoobarBuilder[Impl].class)}
+ * on the class (where <em>Foobar</em> is the name of the annotated class).</li>
* <li>Copy Jackson-related configuration annotations (like
* {@code @JsonIgnoreProperties}) from the class to the builder class. This is
- * necessary so that Jackson recognizes them when using the builder.
+ * necessary so that Jackson recognizes them when using the builder.</li>
* <li>Insert {@code @JsonPOJOBuilder(withPrefix="")} on the generated builder
* class to override Jackson's default prefix "with". If you configured a
* different prefix in lombok using {@code setterPrefix}, this value is used. If
* you changed the name of the {@code build()} method using using
- * {@code buildMethodName}, this is also made known to Jackson.
+ * {@code buildMethodName}, this is also made known to Jackson.</li>
* <li>For {@code @SuperBuilder}, make the builder implementation class
* package-private.</li>
* </ul>
- * This annotation does <i>not</i> change the behavior of the generated builder.
+ * This annotation does <em>not</em> change the behavior of the generated builder.
* A {@code @Jacksonized} {@code @SuperBuilder} remains fully compatible to
* regular {@code @SuperBuilder}s.
*/
diff --git a/src/core/lombok/javac/handlers/HandleJacksonized.java b/src/core/lombok/javac/handlers/HandleJacksonized.java
index 889dd27d..aff0bf63 100644
--- a/src/core/lombok/javac/handlers/HandleJacksonized.java
+++ b/src/core/lombok/javac/handlers/HandleJacksonized.java
@@ -21,6 +21,7 @@
*/
package lombok.javac.handlers;
+import static lombok.core.handlers.HandlerUtil.handleExperimentalFlagUsage;
import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
@@ -59,6 +60,8 @@ import lombok.javac.JavacTreeMaker;
public class HandleJacksonized extends JavacAnnotationHandler<Jacksonized> {
@Override public void handle(AnnotationValues<Jacksonized> annotation, JCAnnotation ast, JavacNode annotationNode) {
+ handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.JACKSONIZED_FLAG_USAGE, "@Jacksonized");
+
JavacNode annotatedNode = annotationNode.up();
deleteAnnotationIfNeccessary(annotationNode, Jacksonized.class);