diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lombok/ConfigurationKeys.java | 9 | ||||
-rw-r--r-- | src/core/lombok/NonNull.java | 16 | ||||
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleNonNull.java | 3 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/HandleNonNull.java | 3 |
4 files changed, 13 insertions, 18 deletions
diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java index a0587bfd..4f46424d 100644 --- a/src/core/lombok/ConfigurationKeys.java +++ b/src/core/lombok/ConfigurationKeys.java @@ -31,6 +31,15 @@ public class ConfigurationKeys { private ConfigurationKeys() {} /** + * lombok configuration: {@code lombok.NonNull.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * <em>Implementation note: This field is supposed to be lombok.NonNull itself, but jdk6 and 7 have bugs where fields in annotations don't work well.</em> + * + * If set, <em>any</em> usage of {@code @NonNull} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> NON_NULL_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.NonNull.flagUsage") {}; + + /** * lombok configuration: {@code lombok.AnyConstructor.flagUsage} = {@code WARNING} | {@code ERROR}. * * If set, <em>any</em> usage of {@code @AllArgsConstructor}, {@code @RequiredArgsConstructor}, or {@code @NoArgsConstructor} results in a warning / error. diff --git a/src/core/lombok/NonNull.java b/src/core/lombok/NonNull.java index 42aa8ba4..58538583 100644 --- a/src/core/lombok/NonNull.java +++ b/src/core/lombok/NonNull.java @@ -27,9 +27,6 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import lombok.core.FlagUsageType; -import lombok.core.configuration.ConfigurationKey; - /** * If put on a parameter, lombok will insert a null-check at the start of the method / constructor's body, throwing a * {@code NullPointerException} with the parameter's name as message. If put on a field, any generated method assigning @@ -48,17 +45,4 @@ import lombok.core.configuration.ConfigurationKey; @Retention(RetentionPolicy.CLASS) @Documented public @interface NonNull { - /** - * lombok configuration: {@code lombok.NonNull.flagUsage} = {@code WARNING} | {@code ERROR}. - * - * If set, <em>any</em> usage of {@code @NonNull} results in a warning / error. - */ - ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.NonNull.flagUsage") {}; - - /** - * lombok configuration: {@code lombok.NonNull.noNullChecks} = {@code true} | {@code false}. - * - * If set, the lombok feature of generating a null-checking if statement for all parameters annotated with {@code @NonNull} is disabled. - */ - ConfigurationKey<Boolean> NO_NULL_CHECKS = new ConfigurationKey<Boolean>("lombok.NonNull.noNullChecks") {}; } diff --git a/src/core/lombok/eclipse/handlers/HandleNonNull.java b/src/core/lombok/eclipse/handlers/HandleNonNull.java index b255d4e1..af32af84 100644 --- a/src/core/lombok/eclipse/handlers/HandleNonNull.java +++ b/src/core/lombok/eclipse/handlers/HandleNonNull.java @@ -27,6 +27,7 @@ import static lombok.eclipse.handlers.EclipseHandlerUtil.*; import java.util.Arrays; +import lombok.ConfigurationKeys; import lombok.NonNull; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; @@ -58,7 +59,7 @@ import org.mangosdk.spi.ProviderFor; @HandlerPriority(value = 512) // 2^9; onParameter=@__(@NonNull) has to run first. public class HandleNonNull extends EclipseAnnotationHandler<NonNull> { @Override public void handle(AnnotationValues<NonNull> annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, NonNull.FLAG_USAGE, "@NonNull"); + handleFlagUsage(annotationNode, ConfigurationKeys.NON_NULL_FLAG_USAGE, "@NonNull"); if (annotationNode.up().getKind() == Kind.FIELD) { // This is meaningless unless the field is used to generate a method (@Setter, @RequiredArgsConstructor, etc), diff --git a/src/core/lombok/javac/handlers/HandleNonNull.java b/src/core/lombok/javac/handlers/HandleNonNull.java index 99bf2688..e57c63dd 100644 --- a/src/core/lombok/javac/handlers/HandleNonNull.java +++ b/src/core/lombok/javac/handlers/HandleNonNull.java @@ -43,6 +43,7 @@ import com.sun.tools.javac.tree.JCTree.JCTry; import com.sun.tools.javac.tree.JCTree.JCVariableDecl; import com.sun.tools.javac.util.List; +import lombok.ConfigurationKeys; import lombok.NonNull; import lombok.core.AnnotationValues; import lombok.core.HandlerPriority; @@ -56,7 +57,7 @@ import static lombok.javac.JavacTreeMaker.TreeTag.*; @HandlerPriority(value = 512) // 2^9; onParameter=@__(@NonNull) has to run first. public class HandleNonNull extends JavacAnnotationHandler<NonNull> { @Override public void handle(AnnotationValues<NonNull> annotation, JCAnnotation ast, JavacNode annotationNode) { - handleFlagUsage(annotationNode, NonNull.FLAG_USAGE, "@NonNull"); + handleFlagUsage(annotationNode, ConfigurationKeys.NON_NULL_FLAG_USAGE, "@NonNull"); if (annotationNode.up().getKind() == Kind.FIELD) { // This is meaningless unless the field is used to generate a method (@Setter, @RequiredArgsConstructor, etc), |