diff options
64 files changed, 402 insertions, 338 deletions
diff --git a/src/core/lombok/AllArgsConstructor.java b/src/core/lombok/AllArgsConstructor.java index 6936e778..068b7a68 100644 --- a/src/core/lombok/AllArgsConstructor.java +++ b/src/core/lombok/AllArgsConstructor.java @@ -26,9 +26,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; - /** * Generates an all-args constructor. * An all-args constructor requires one argument for every field in the class. @@ -44,13 +41,6 @@ import lombok.core.configuration.ConfigurationKey; @Retention(RetentionPolicy.SOURCE) public @interface AllArgsConstructor { /** - * lombok configuration: {@code lombok.AllArgsConstructor.flagUsage} = {@code WARNING} | {@code ERROR}. - * - * If set, <em>any</em> usage of {@code @AllArgsConstructor} results in a warning / error. - */ - ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.AllArgsConstructor.flagUsage") {}; - - /** * If set, the generated constructor will be private, and an additional static 'constructor' * is generated with the same argument list that wraps the real constructor. * diff --git a/src/core/lombok/Cleanup.java b/src/core/lombok/Cleanup.java index 77a1ac87..4b5c6fc2 100644 --- a/src/core/lombok/Cleanup.java +++ b/src/core/lombok/Cleanup.java @@ -26,9 +26,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; - /** * Ensures the variable declaration that you annotate will be cleaned up by calling its close method, regardless * of what happens. Implemented by wrapping all statements following the local variable declaration to the @@ -75,13 +72,6 @@ import lombok.core.configuration.ConfigurationKey; @Target(ElementType.LOCAL_VARIABLE) @Retention(RetentionPolicy.SOURCE) public @interface Cleanup { - /** - * lombok configuration: {@code lombok.Cleanup.flagUsage} = {@code WARNING} | {@code ERROR}. - * - * If set, <em>any</em> usage of {@code @Cleanup} results in a warning / error. - */ - ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Cleanup.flagUsage") {}; - /** The name of the method that cleans up the resource. By default, 'close'. The method must not have any parameters. */ String value() default "close"; } diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java index 4f46424d..8e90877b 100644 --- a/src/core/lombok/ConfigurationKeys.java +++ b/src/core/lombok/ConfigurationKeys.java @@ -30,6 +30,115 @@ import lombok.core.configuration.ConfigurationKey; public class ConfigurationKeys { private ConfigurationKeys() {} + // ##### main package features ##### + + // ----- *ArgsConstructor ----- + + /** + * 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. + */ + public static final ConfigurationKey<FlagUsageType> ANY_CONSTRUCTOR_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.AnyConstructor.flagUsage") {}; + + /** + * lombok configuration: {@code lombok.AllArgsConstructor.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @AllArgsConstructor} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> ALL_ARGS_CONSTRUCTOR_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.AllArgsConstructor.flagUsage") {}; + + /** + * lombok configuration: {@code lombok.NoArgsConstructor.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @NoArgsConstructor} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> NO_ARGS_CONSTRUCTOR_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.NoArgsConstructor.flagUsage") {}; + + /** + * lombok configuration: {@code lombok.RequiredArgsConstructor.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @RequiredArgsConstructor} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> REQUIRED_ARGS_CONSTRUCTOR_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.RequiredArgsConstructor.flagUsage") {}; + + // ##### Beanies ##### + + // ----- Data ----- + + /** + * lombok configuration: {@code lombok.Data.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Data} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> DATA_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Data.flagUsage") {}; + + // ----- Value ----- + + /** + * lombok configuration: {@code lombok.Value.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Value} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> VALUE_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Value.flagUsage") {}; + + // ----- Getter ----- + + /** + * lombok configuration: {@code lombok.Getter.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Getter} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> GETTER_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Getter.flagUsage") {}; + + // ----- Setter ----- + + /** + * lombok configuration: {@code lombok.Setter.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Setter} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> SETTER_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Setter.flagUsage") {}; + + // ----- EqualsAndHashCode ----- + + /** + * lombok configuration: {@code lombok.EqualsAndHashCode.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @EqualsAndHashCode} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> EQUALS_AND_HASH_CODE_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.EqualsAndHashCode.flagUsage") {}; + + // ----- ToString ----- + /** + * lombok configuration: {@code lombok.ToString.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @ToString} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> TO_STRING_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.ToString.flagUsage") {}; + + // ##### Standalones ##### + + // ----- Cleanup ----- + + /** + * lombok configuration: {@code lombok.Cleanup.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Cleanup} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> CLEANUP_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Cleanup.flagUsage") {}; + + // ----- Delegate ----- + + /** + * lombok configuration: {@code lombok.Delegate.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Delegate} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> DELEGATE_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Delegate.flagUsage") {}; + + // ----- NonNull ----- + /** * lombok configuration: {@code lombok.NonNull.flagUsage} = {@code WARNING} | {@code ERROR}. * @@ -39,26 +148,91 @@ public class ConfigurationKeys { */ public static final ConfigurationKey<FlagUsageType> NON_NULL_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.NonNull.flagUsage") {}; + // ----- SneakyThrows ----- + /** - * lombok configuration: {@code lombok.AnyConstructor.flagUsage} = {@code WARNING} | {@code ERROR}. + * lombok configuration: {@code lombok.SneakyThrows.flagUsage} = {@code WARNING} | {@code ERROR}. * - * If set, <em>any</em> usage of {@code @AllArgsConstructor}, {@code @RequiredArgsConstructor}, or {@code @NoArgsConstructor} results in a warning / error. + * If set, <em>any</em> usage of {@code @SneakyThrows} results in a warning / error. */ - public static final ConfigurationKey<FlagUsageType> ANY_CONSTRUCTOR_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.AnyConstructor.flagUsage") {}; + public static final ConfigurationKey<FlagUsageType> SNEAKY_THROWS_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.SneakyThrows.flagUsage") {}; + + // ----- Synchronized ----- + + /** + * lombok configuration: {@code lombok.Synchronized.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Synchronized} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> SYNCHRONIZED_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Synchronized.flagUsage") {}; + // ----- val ----- + + /** + * lombok configuration: {@code lombok.val.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code val} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> VAL_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.val.flagUsage") {}; + + // ##### Extern ##### + + // ----- Logging ----- /** * lombok configuration: {@code lombok.log.flagUsage} = {@code WARNING} | {@code ERROR}. * * If set, <em>any</em> usage of any of the log annotations in {@code lombok.extern}{@code @Slf4j} results in a warning / error. */ - public static final ConfigurationKey<FlagUsageType> ANY_LOG_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.flagUsage") {}; + public static final ConfigurationKey<FlagUsageType> LOG_ANY_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.flagUsage") {}; + + /** + * lombok configuration: {@code lombok.log.apacheCommons.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @CommonsLog} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> LOG_COMMONS_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.apacheCommons.flagUsage") {}; + + /** + * lombok configuration: {@code lombok.log.javaUtilLogging.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Log} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> LOG_JUL_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.javaUtilLogging.flagUsage") {}; + + /** + * lombok configuration: {@code lombok.log.log4j.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Log4j} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> LOG_LOG4J_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.log4j.flagUsage") {}; + + /** + * lombok configuration: {@code lombok.log.log4j2.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Log4j2} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> LOG_LOG4J2_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.log4j2.flagUsage") {}; + + /** + * lombok configuration: {@code lombok.log.slf4j.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Slf4j} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> LOG_SLF4J_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.slf4j.flagUsage") {}; + + /** + * lombok configuration: {@code lombok.log.xslf4j.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @XSlf4j} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> LOG_XSLF4J_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.xslf4j.flagUsage") {}; /** * lombok configuration: {@code lombok.log.fieldName} = "aJavaIdentifier". * * If set the various log annotations (which make a log field) will use the stated identifier instead of {@code log} as a name. */ - public static final ConfigurationKey<String> ANY_LOG_FIELD_NAME = new ConfigurationKey<String>("lombok.log.fieldName"){}; + public static final ConfigurationKey<String> LOG_ANY_FIELD_NAME = new ConfigurationKey<String>("lombok.log.fieldName") {}; /** * lombok configuration: {@code lombok.log.fieldIsStatic} = {@code true} | {@code false}. @@ -67,7 +241,9 @@ public class ConfigurationKeys { * * If set to {@code false}, these will be generated as instance fields instead. */ - public static final ConfigurationKey<Boolean> ANY_LOG_FIELD_IS_STATIC = new ConfigurationKey<Boolean>("lombok.log.fieldIsStatic"){}; + public static final ConfigurationKey<Boolean> LOG_ANY_FIELD_IS_STATIC = new ConfigurationKey<Boolean>("lombok.log.fieldIsStatic") {}; + + // ##### Experimental ##### /** * lombok configuration: {@code lombok.experimental.flagUsage} = {@code WARNING} | {@code ERROR}. @@ -76,4 +252,49 @@ public class ConfigurationKeys { * promoted to a main feature results in a warning / error. */ public static final ConfigurationKey<FlagUsageType> EXPERIMENTAL_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.experimental.flagUsage") {}; + + // ----- Accessors ----- + + /** + * lombok configuration: {@code lombok.Accessors.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Accessors} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> ACCESSORS_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Accessors.flagUsage") {}; + + // ----- Builder ----- + + /** + * lombok configuration: {@code lombok.Builder.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Builder} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> BUILDER_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Builder.flagUsage") {}; + + // ----- ExtensionMethod ----- + + /** + * lombok configuration: {@code lombok.ExtensionMethod.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @ExtensionMethod} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> EXTENSION_METHOD_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.ExtensionMethod.flagUsage") {}; + + // ----- FieldDefaults ----- + + /** + * lombok configuration: {@code lombok.FieldDefaults.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @FieldDefaults} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> FIELD_DEFAULTS_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.FieldDefaults.flagUsage") {}; + + // ----- Wither ----- + + /** + * lombok configuration: {@code lombok.Wither.flagUsage} = {@code WARNING} | {@code ERROR}. + * + * If set, <em>any</em> usage of {@code @Value} results in a warning / error. + */ + public static final ConfigurationKey<FlagUsageType> WITHER_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Wither.flagUsage") {}; } diff --git a/src/core/lombok/Data.java b/src/core/lombok/Data.java index 46703461..bbc8d920 100644 --- a/src/core/lombok/Data.java +++ b/src/core/lombok/Data.java @@ -26,9 +26,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; - /** * Generates getters for all fields, a useful toString method, and hashCode and equals implementations that check * all non-transient fields. Will also generate setters for all non-final fields, as well as a constructor. @@ -48,13 +45,6 @@ import lombok.core.configuration.ConfigurationKey; @Retention(RetentionPolicy.SOURCE) public @interface Data { /** - * lombok configuration: {@code lombok.Data.flagUsage} = {@code WARNING} | {@code ERROR}. - * - * If set, <em>any</em> usage of {@code @Data} results in a warning / error. - */ - ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Data.flagUsage") {}; - - /** * If you specify a static constructor name, then the generated constructor will be private, and * instead a static factory method is created that other classes can use to create instances. * We suggest the name: "of", like so: diff --git a/src/core/lombok/Delegate.java b/src/core/lombok/Delegate.java index 14dba196..534cfb3d 100644 --- a/src/core/lombok/Delegate.java +++ b/src/core/lombok/Delegate.java @@ -26,9 +26,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; - /** * Put on any field to make lombok generate delegate methods that forward the call to this field. * @@ -49,13 +46,6 @@ import lombok.core.configuration.ConfigurationKey; @Retention(RetentionPolicy.SOURCE) public @interface Delegate { /** - * lombok configuration: {@code lombok.Delegate.flagUsage} = {@code WARNING} | {@code ERROR}. - * - * If set, <em>any</em> usage of {@code @Delegate} results in a warning / error. - */ - ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.Delegate.flagUsage") {}; - - /** * Normally the type of the field is used as delegate type. However, to choose a different type to delegate, you can list one (or more) types here. Note that types with * type arguments can only be done as a field type. A solution for this is to create a private inner interface/class with the appropriate types extended, and possibly * with all methods you'd like to delegate listed, and then supply that class here. The field does not actually have to implement the type you're delegating; the diff --git a/src/core/lombok/EqualsAndHashCode.java b/src/core/lombok/EqualsAndHashCode.java index a4f0ed45..60ed9e7a 100644 --- a/src/core/lombok/EqualsAndHashCode.java +++ b/src/core/lombok/EqualsAndHashCode.java @@ -26,9 +26,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; - /** * Generates implementations for the {@code equals} and {@code hashCode} methods inherited by all objects, based on relevant fields. * <p> @@ -38,13 +35,6 @@ import lombok.core.configuration.ConfigurationKey; @Retention(RetentionPolicy.SOURCE) public @interface EqualsAndHashCode { /** - * lombok configuration: {@code lombok.EqualsAndHashCode.flagUsage} = {@code WARNING} | {@code ERROR}. - * - * If set, <em>any</em> usage of {@code @EqualsAndHashCode} results in a warning / error. - */ - ConfigurationKey<FlagUsageType> FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.EqualsAndHashCode.flagUsage") {}; - - /** * Any fields listed here will not be taken into account in the generated * {@code equals} and {@code hashCode} implementations. * Mutually exclusive with {@link #of()}. diff --git a/src/core/lombok/Getter.java b/src/core/lombok/Getter.java index a38a0ca5..57f5e40a 100644 --- a/src/core/lombok/Getter.java +++ b/src/core/lombok/Getter.java @@ -26,9 +26,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; - /** * Put on any field to make lombok build a standard getter. * <p> @@ -56,13 +53,6 @@ import lombok.core.configuration.ConfigurationKey; @Retention(RetentionPolicy.SOURCE) public @interface Getter { /** - * lombok confi |
