aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS7
-rw-r--r--buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.26.xml14
-rw-r--r--buildScripts/ivy.xml5
-rw-r--r--doc/changelog.markdown17
-rwxr-xr-xsendSupporters11
-rw-r--r--src/core/lombok/ConfigurationKeys.java28
-rw-r--r--src/core/lombok/core/AnnotationValues.java24
-rw-r--r--src/core/lombok/core/Version.java5
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java24
-rw-r--r--src/core/lombok/eclipse/handlers/HandleConstructor.java52
-rw-r--r--src/core/lombok/eclipse/handlers/HandleData.java1
-rw-r--r--src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java7
-rw-r--r--src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java26
-rw-r--r--src/core/lombok/eclipse/handlers/HandleLog.java36
-rw-r--r--src/core/lombok/eclipse/handlers/HandleValue.java1
-rw-r--r--src/core/lombok/experimental/FieldNameConstants.java2
-rw-r--r--src/core/lombok/extern/apachecommons/CommonsLog.java1
-rw-r--r--src/core/lombok/extern/flogger/Flogger.java62
-rw-r--r--src/core/lombok/extern/java/Log.java1
-rw-r--r--src/core/lombok/extern/jbosslog/JBossLog.java3
-rw-r--r--src/core/lombok/extern/log4j/Log4j.java1
-rw-r--r--src/core/lombok/extern/log4j/Log4j2.java1
-rw-r--r--src/core/lombok/extern/slf4j/Slf4j.java1
-rw-r--r--src/core/lombok/extern/slf4j/XSlf4j.java1
-rw-r--r--src/core/lombok/javac/handlers/HandleConstructor.java78
-rw-r--r--src/core/lombok/javac/handlers/HandleData.java4
-rw-r--r--src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java37
-rw-r--r--src/core/lombok/javac/handlers/HandleFieldNameConstants.java26
-rw-r--r--src/core/lombok/javac/handlers/HandleLog.java37
-rw-r--r--src/core/lombok/javac/handlers/HandleValue.java1
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java8
-rw-r--r--src/core9/module-info.java1
-rw-r--r--src/delombok/lombok/delombok/Delombok.java1
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java1
-rw-r--r--test/transform/resource/after-delombok/DataConfiguration.java4
-rw-r--r--test/transform/resource/after-delombok/FieldNameConstantsBasic.java4
-rw-r--r--test/transform/resource/after-delombok/FieldNameConstantsConfigKeys.java4
-rw-r--r--test/transform/resource/after-delombok/FieldNameConstantsWeird.java2
-rw-r--r--test/transform/resource/after-delombok/LoggerFlogger.java14
-rw-r--r--test/transform/resource/after-delombok/NoPrivateNoArgsConstructor.java73
-rw-r--r--test/transform/resource/after-delombok/PrivateNoArgsConstructor.java236
-rw-r--r--test/transform/resource/after-ecj/DataConfiguration.java4
-rw-r--r--test/transform/resource/after-ecj/FieldNameConstantsBasic.java4
-rw-r--r--test/transform/resource/after-ecj/FieldNameConstantsConfigKeys.java9
-rw-r--r--test/transform/resource/after-ecj/FieldNameConstantsWeird.java6
-rw-r--r--test/transform/resource/after-ecj/LoggerFlogger.java30
-rw-r--r--test/transform/resource/after-ecj/NoPrivateNoArgsConstructor.java68
-rw-r--r--test/transform/resource/after-ecj/PrivateNoArgsConstructor.java219
-rw-r--r--test/transform/resource/before/DataConfiguration.java1
-rw-r--r--test/transform/resource/before/FieldNameConstantsConfigKeys.java7
-rw-r--r--test/transform/resource/before/FieldNameConstantsWeird.java3
-rw-r--r--test/transform/resource/before/LoggerFlogger.java16
-rw-r--r--test/transform/resource/before/NoPrivateNoArgsConstructor.java12
-rw-r--r--test/transform/resource/before/PrivateNoArgsConstructor.java41
-rw-r--r--test/transform/resource/messages-delombok/FieldNameConstantsWeird.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/FieldNameConstantsWeird.java.messages2
-rw-r--r--website/templates/features/experimental/FieldNameConstants.html14
-rw-r--r--website/templates/features/log.html22
58 files changed, 1191 insertions, 131 deletions
diff --git a/AUTHORS b/AUTHORS
index 04cb2061..4e6f6e52 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,6 +1,7 @@
Lombok contributors in alphabetical order:
Bulgakov Alexander <buls@yandex.ru>
+Christian Nüssgens <christian@nuessgens.com>
Christian Sterzl <christian.sterzl@gmail.com>
DaveLaw <project.lombok@apconsult.de>
Dave Brosius <dbrosius@mebigfatguy.com>
@@ -12,7 +13,9 @@ Liu DongMiao <liudongmiao@gmail.com>
Luan Nico <luannico27@gmail.com>
Maarten Mulders <mthmulders@users.noreply.github.com>
Mart Hagenaars <marthagenaars@gmail.com>
+Mateusz Matela <mateusz.matela@gmail.com>
Michiel Verheul <cheelio@gmail.com>
+Pascal Bihler <pascal@qfs.de>
Peter Grant <petercgrant@users.noreply.github.com>
Philipp Eichhorn <peichhor@web.de>
Rabea Gransberger <rgra@users.noreply.github.com>
@@ -21,12 +24,10 @@ Robbert Jan Grootjans <grootjans@gmail.com>
Roel Spilker <r.spilker@gmail.com>
Sander Koning <askoning@gmail.com>
Szymon Pacanowski <spacanowski@gmail.com>
-Takuya Murakami <tmurakam@tmurakam.org>
Taiki Sugawara <buzz.taiki@gmail.com>
+Takuya Murakami <tmurakam@tmurakam.org>
Thomas Darimont <thomas.darimont@gmail.com>
Victor Williams Stafusa da Silva <victorwssilva@gmail.com>
Yun Zhi Lin <yun@yunspace.com>
-Christian Nüssgens <christian@nuessgens.com>
-Mateusz Matela <mateusz.matela@gmail.com>
By adding your name to this list, you grant full and irrevocable copyright and patent indemnity to Project Lombok and all use of Project Lombok, and you certify that you have the right to do so for all commits you add to Project Lombok.
diff --git a/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.26.xml b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.26.xml
new file mode 100644
index 00000000..6525604f
--- /dev/null
+++ b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.26.xml
@@ -0,0 +1,14 @@
+<ivy-module version="2.0">
+ <info organisation="org.projectlombok" module="lombok.patcher" revision="0.26" publication="20180528200000">
+ <license name="MIT License" url="https://www.opensource.org/licenses/mit-license.php" />
+ <ivyauthor name="rzwitserloot" url="https://github.com/rzwitserloot" />
+ <ivyauthor name="rspilker" url="https://github.com/rspilker" />
+ <description homepage="https://projectlombok.org/" />
+ </info>
+ <configurations>
+ <conf name="default" />
+ </configurations>
+ <publications>
+ <artifact conf="default" url="https://projectlombok.org/downloads/lombok.patcher-0.26.jar" />
+ </publications>
+</ivy-module>
diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml
index a27c909e..c1ddc6fd 100644
--- a/buildScripts/ivy.xml
+++ b/buildScripts/ivy.xml
@@ -17,7 +17,7 @@
<conf name="supporters" />
</configurations>
<dependencies>
- <dependency org="org.projectlombok" name="lombok.patcher" rev="0.24" conf="buildBase->default; runtime->default" />
+ <dependency org="org.projectlombok" name="lombok.patcher" rev="0.26" conf="buildBase->default; runtime->default" />
<dependency org="zwitserloot.com" name="cmdreader" rev="1.2" conf="buildBase->runtime; runtime" />
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default; contrib->sources" />
@@ -26,7 +26,8 @@
<dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="test->default; contrib->sources" />
<dependency org="org.slf4j" name="slf4j-api" rev="1.6.1" conf="test->default; contrib->sources" />
<dependency org="org.slf4j" name="slf4j-ext" rev="1.6.1" conf="test->default; contrib->sources" />
- <dependency org="org.jboss.logging" name="jboss-logging" rev="3.3.0.Final" conf="test->default; contrib->sources" />
+ <dependency org="org.jboss.logging" name="jboss-logging" rev="3.3.0.Final" conf="test->default; contrib->sources" />
+ <dependency org="com.google.flogger" name="flogger" rev="0.2" conf="test->default; contrib->sources" />
<dependency org="com.google.guava" name="guava" rev="18.0" conf="test->default; contrib->sources" />
<dependency org="com.google.code.findbugs" name="findbugs" rev="3.0.0" conf="test->master" />
diff --git a/doc/changelog.markdown b/doc/changelog.markdown
index d6e8af33..f8b8a562 100644
--- a/doc/changelog.markdown
+++ b/doc/changelog.markdown
@@ -1,14 +1,23 @@
Lombok Changelog
----------------
-### v1.16.21 "Edgy Guinea Pig"
-* v1.16.20 is the latest stable release of Project Lombok.
+### v1.16.23 "Edgy Guinea Pig"
+* v1.16.22 is the latest stable release of Project Lombok.
+* BREAKING CHANGE: The in 1.16.22 introduced configuration key `lombok.noArgsConstructor.extraPrivate` is now `false` by default. [Issue #1708](https://github.com/rzwitserloot/lombok/issues/1708)
+* BUGFIX: Do not generate a private no-args constructor if that breaks the code. [Issue #1703](https://github.com/rzwitserloot/lombok/issues/1703), [Issue #1704](https://github.com/rzwitserloot/lombok/issues/1704), [Issue #1712](https://github.com/rzwitserloot/lombok/issues/1712)
+* BUGFIX: Using boolean parameters in lombok annotations would fail. [Issue #1709](https://github.com/rzwitserloot/lombok/issues/1709)
+* BUGFIX: Delombok would give an error message. [Issue #1705](https://github.com/rzwitserloot/lombok/issues/1705)
+* FEATURE: Google's [Flogger (a.k.a. FluentLogger)](https://google.github.io/flogger/) is now available via `@Flogger`. [Issue #1697](https://github.com/rzwitserloot/lombok/issues/1697)
+* FEATURE: `@FieldNameConstants` has been extended to support prefixes and suffixes. By default, the generated constants are prefixed with `FIELD_`. [Docs on @FieldNameConstants](https://projectlombok.org/features/experimental/FieldNameConstants).
+
+### v1.16.22 "Envious Ferret" (May 29th, 2018)
+* FEATURE: Private no-args constructor for `@Data` and `@Value` to enable deserialization frameworks (like Jackson) to operate out-of-the-box. Use `lombok.noArgsConstructor.extraPrivate = false` to disable this behavior.
* FEATURE: Methods can now be marked for inclusion in `toString`, `equals`, and `hashCode` generation. There is a new mechanism to mark which fields (and now, methods) are to be included or excluded for the generation of these methods: mark the relevant member with for example `@ToString.Include` or `@EqualsAndHashCode.Exclude`. [ToString documentation](https://projectlombok.org/features/ToString) [EqualsAndHashCode documentation](https://projectlombok.org/features/EqualsAndHashCode)
* FEATURE: `@Getter` and `@Setter` also allow `onMethod` and `onParam` when put on a type. [Issue #1653](https://github.com/rzwitserloot/lombok/issues/1653)
* FEATURE: `@FieldNameConstants` is a new feature that generates string constants for your field names. [Docs on @FieldNameConstants](https://projectlombok.org/features/experimental/FieldNameConstants).
+* PLATFORM: Lombok can be compiled on JDK10, and should run on JDK10. [Issue #1693](https://github.com/rzwitserloot/lombok/issues/1693)
* PLATFORM: lombok now counts as an _incremental annotation processor_ for gradle. Should speed up your gradle builds considerably! [Issue #1580](https://github.com/rzwitserloot/lombok/issues/1580)
-* PLATFORM: Fix for using lombok together with JDK9's new `module-info.java` feature. [Issue #985](https://github.com/rzwitserloot/lombok/issues/985)
-* PLATFORM: Some initial work on supporting JDK10 and JDK11.
+* PLATFORM: Fix for using lombok together with JDK9+'s new `module-info.java` feature. [Issue #985](https://github.com/rzwitserloot/lombok/issues/985)
* BUGFIX: Solved some issues in eclipse that resulted in error 'A save participant caused problems'. [Issue #879](https://github.com/rzwitserloot/lombok/issues/879)
* BUGFIX: Netbeans on jdk9. [Issue #1617](https://github.com/rzwitserloot/lombok/issues/1617)
* BUGFIX: Netbeans < 9. [Issue #1555](https://github.com/rzwitserloot/lombok/issues/1555)
diff --git a/sendSupporters b/sendSupporters
new file mode 100755
index 00000000..ecc18c55
--- /dev/null
+++ b/sendSupporters
@@ -0,0 +1,11 @@
+#!/bin/bash
+BASE=`dirname $0`
+scp "$BASE/website/lombokSupporters/supporters.json" "escudo:/data/lombok/web/files/supporters.json"
+if [ "$*" != "" ]; then
+ for var in "$@"; do
+ scp "$BASE/website/lombokSupporters/logos/$var" "escudo:/data/lombok/web/files/logos/$var"
+ done
+fi
+
+echo Dont forget to list images as arguments
+
diff --git a/src/core/lombok/ConfigurationKeys.java b/src/core/lombok/ConfigurationKeys.java
index 7efe20bd..46c3f770 100644
--- a/src/core/lombok/ConfigurationKeys.java
+++ b/src/core/lombok/ConfigurationKeys.java
@@ -126,6 +126,13 @@ public class ConfigurationKeys {
public static final ConfigurationKey<FlagUsageType> NO_ARGS_CONSTRUCTOR_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.noArgsConstructor.flagUsage", "Emit a warning or error if @NoArgsConstructor is used.") {};
/**
+ * lombok configuration: {@code lombok.noArgsConstructor.extraPrivate} = {@code true} | {@code false}.
+ *
+ * If {@code true} (default), @Data and @Value will also generate a private no-args constructor, if there isn't already one, setting all fields to their default values.
+ */
+ public static final ConfigurationKey<Boolean> NO_ARGS_CONSTRUCTOR_EXTRA_PRIVATE = new ConfigurationKey<Boolean>("lombok.noArgsConstructor.extraPrivate", "Generate a private no-ars constructor for @Data and @Value (default: true).") {};
+
+ /**
* lombok configuration: {@code lombok.requiredArgsConstructor.flagUsage} = {@code WARNING} | {@code ERROR}.
*
* If set, <em>any</em> usage of {@code @RequiredArgsConstructor} results in a warning / error.
@@ -383,6 +390,13 @@ public class ConfigurationKeys {
public static final ConfigurationKey<FlagUsageType> LOG_JBOSSLOG_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.jbosslog.flagUsage", "Emit a warning or error if @JBossLog is used.") {};
/**
+ * lombok configuration: {@code lombok.log.flogger.flagUsage} = {@code WARNING} | {@code ERROR}.
+ *
+ * If set, <em>any</em> usage of {@code @Flogger} results in a warning / error.
+ */
+ public static final ConfigurationKey<FlagUsageType> LOG_FLOGGER_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.log.flogger.flagUsage", "Emit a warning or error if @Flogger is used.") {};
+
+ /**
* lombok configuration: {@code lombok.log.fieldName} = &lt;String: aJavaIdentifier&gt; (Default: {@code log}).
*
* If set the various log annotations (which make a log field) will use the stated identifier instead of {@code log} as a name.
@@ -507,6 +521,20 @@ public class ConfigurationKeys {
*/
public static final ConfigurationKey<FlagUsageType> FIELD_NAME_CONSTANTS_FLAG_USAGE = new ConfigurationKey<FlagUsageType>("lombok.fieldNameConstants.flagUsage", "Emit a warning or error if @FieldNameConstants is used.") {};
+ /**
+ * lombok configuration: {@code lombok.fieldNameConstants.prefix} = &lt;String: aJavaIdentifierPrefix&gt; (Default: {@code PREFIX_}).
+ *
+ * The names of the constants generated by {@code @FieldNameConstants} will be prefixed with this value.
+ */
+ public static final ConfigurationKey<String> FIELD_NAME_CONSTANTS_PREFIX = new ConfigurationKey<String>("lombok.fieldNameConstants.prefix", "names of constants generated by @FieldNameConstants will be prefixed with this value. (default: 'PREFIX_').") {};
+
+ /**
+ * lombok configuration: {@code lombok.fieldNameConstants.suffix} = &lt;String: aJavaIdentifierPrefix&gt; (Default: nothing).
+ *
+ * The names of the constants generated by {@code @FieldNameConstants} will be suffixed with this value.
+ */
+ public static final ConfigurationKey<String> FIELD_NAME_CONSTANTS_SUFFIX = new ConfigurationKey<String>("lombok.fieldNameConstants.suffix", "names of constants generated by @FieldNameConstants will be suffixed with this value. (default: nothing).") {};
+
// ----- Wither -----
/**
diff --git a/src/core/lombok/core/AnnotationValues.java b/src/core/lombok/core/AnnotationValues.java
index b6e78de4..a24330fa 100644
--- a/src/core/lombok/core/AnnotationValues.java
+++ b/src/core/lombok/core/AnnotationValues.java
@@ -200,12 +200,12 @@ public class AnnotationValues<A extends Annotation> {
public boolean getAsBoolean(String methodName) {
AnnotationValue v = values.get(methodName);
if (v == null || v.valueGuesses.size() != 1) {
- return getDefaultIf(methodName, Boolean.class, false);
+ return getDefaultIf(methodName, boolean.class, false);
}
- Object guess = guessToType(v.valueGuesses.get(0), Boolean.class, v, 0);
+ Object guess = guessToType(v.valueGuesses.get(0), boolean.class, v, 0);
if (guess instanceof Boolean) return ((Boolean) guess).booleanValue();
- return getDefaultIf(methodName, Boolean.class, false);
+ return getDefaultIf(methodName, boolean.class, false);
}
public <T> T getDefaultIf(String methodName, Class<T> type, T defaultValue) {
@@ -286,19 +286,19 @@ public class AnnotationValues<A extends Annotation> {
}
private Object guessToType(Object guess, Class<?> expected, AnnotationValue v, int pos) {
- if (expected == int.class) {
+ if (expected == int.class || expected == Integer.class) {
if (guess instanceof Integer || guess instanceof Short || guess instanceof Byte) {
return ((Number) guess).intValue();
}
}
- if (expected == long.class) {
+ if (expected == long.class || expected == Long.class) {
if (guess instanceof Long || guess instanceof Integer || guess instanceof Short || guess instanceof Byte) {
return ((Number) guess).longValue();
}
}
- if (expected == short.class) {
+ if (expected == short.class || expected == Short.class) {
if (guess instanceof Integer || guess instanceof Short || guess instanceof Byte) {
int intVal = ((Number) guess).intValue();
int shortVal = ((Number) guess).shortValue();
@@ -306,7 +306,7 @@ public class AnnotationValues<A extends Annotation> {
}
}
- if (expected == byte.class) {
+ if (expected == byte.class || expected == Byte.class) {
if (guess instanceof Integer || guess instanceof Short || guess instanceof Byte) {
int intVal = ((Number) guess).intValue();
int byteVal = ((Number) guess).byteValue();
@@ -314,19 +314,19 @@ public class AnnotationValues<A extends Annotation> {
}
}
- if (expected == double.class) {
+ if (expected == double.class || expected == Double.class) {
if (guess instanceof Number) return ((Number) guess).doubleValue();
}
- if (expected == float.class) {
+ if (expected == float.class || expected == Float.class) {
if (guess instanceof Number) return ((Number) guess).floatValue();
}
- if (expected == boolean.class) {
+ if (expected == boolean.class || expected == Boolean.class) {
if (guess instanceof Boolean) return ((Boolean) guess).booleanValue();
}
- if (expected == char.class) {
+ if (expected == char.class || expected == Character.class) {
if (guess instanceof Character) return ((Character) guess).charValue();
}
@@ -346,7 +346,7 @@ public class AnnotationValues<A extends Annotation> {
}
}
- if (Class.class == expected) {
+ if (expected == Class.class) {
if (guess instanceof ClassLiteral) try {
String classLit = ((ClassLiteral) guess).getClassName();
return Class.forName(toFQ(classLit));
diff --git a/src/core/lombok/core/Version.java b/src/core/lombok/core/Version.java
index 98f1e575..dc0900f6 100644
--- a/src/core/lombok/core/Version.java
+++ b/src/core/lombok/core/Version.java
@@ -30,15 +30,16 @@ public class Version {
// ** CAREFUL ** - this class must always compile with 0 dependencies (it must not refer to any other sources or libraries).
// Note: In 'X.Y.Z', if Z is odd, its a snapshot build built from the repository, so many different 0.10.3 versions can exist, for example.
// Official builds always end in an even number. (Since 0.10.2).
- private static final String VERSION = "1.16.21";
+ private static final String VERSION = "1.16.23";
private static final String RELEASE_NAME = "Edgy Guinea Pig";
-// private static final String RELEASE_NAME = "Dancing Elephant";
+// private static final String RELEASE_NAME = "Envious Ferret";
// Named version history:
// Angry Butterfly
// Branching Cobra
// Candid Duck
// Dancing Elephant
+ // Envious Ferret
private Version() {
//Prevent instantiation
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index 1758a220..2dce285c 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -1198,6 +1198,12 @@ public class EclipseHandlerUtil {
return AnnotationValues.of(Accessors.class, field);
}
+
+ public static EclipseNode upToTypeNode(EclipseNode node) {
+ if (node == null) throw new NullPointerException("node");
+ while (node != null && !(node.get() instanceof TypeDeclaration)) node = node.up();
+ return node;
+ }
/**
* Checks if there is a field with the provided name.
@@ -1206,10 +1212,7 @@ public class EclipseHandlerUtil {
* @param node Any node that represents the Type (TypeDeclaration) to look in, or any child node thereof.
*/
public static MemberExistsResult fieldExists(String fieldName, EclipseNode node) {
- while (node != null && !(node.get() instanceof TypeDeclaration)) {
- node = node.up();
- }
-
+ node = upToTypeNode(node);
if (node != null && node.get() instanceof TypeDeclaration) {
TypeDeclaration typeDecl = (TypeDeclaration)node.get();
if (typeDecl.fields != null) for (FieldDeclaration def : typeDecl.fields) {
@@ -1295,10 +1298,7 @@ public class EclipseHandlerUtil {
* @param node Any node that represents the Type (TypeDeclaration) to look in, or any child node thereof.
*/
public static MemberExistsResult constructorExists(EclipseNode node) {
- while (node != null && !(node.get() instanceof TypeDeclaration)) {
- node = node.up();
- }
-
+ node = upToTypeNode(node);
if (node != null && node.get() instanceof TypeDeclaration) {
TypeDeclaration typeDecl = (TypeDeclaration)node.get();
if (typeDecl.methods != null) for (AbstractMethodDeclaration def : typeDecl.methods) {
@@ -1854,4 +1854,12 @@ public class EclipseHandlerUtil {
private static long[] copy(long[] array) {
return array == null ? null : array.clone();
}
+
+ public static boolean isDirectDescendantOfObject(EclipseNode typeNode) {
+ if (!(typeNode.get() instanceof TypeDeclaration)) throw new IllegalArgumentException("not a type node");
+ TypeDeclaration typeDecl = (TypeDeclaration) typeNode.get();
+ if (typeDecl.superclass == null) return true;
+ String p = typeDecl.superclass.toString();
+ return p.equals("Object") || p.equals("java.lang.Object");
+ }
}
diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java
index 62e2c18c..eb7fd711 100644
--- a/src/core/lombok/eclipse/handlers/HandleConstructor.java
+++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java
@@ -42,8 +42,10 @@ import lombok.core.AST.Kind;
import lombok.core.AnnotationValues;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
+import lombok.eclipse.handlers.EclipseHandlerUtil.MemberExistsResult;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.Argument;
@@ -204,6 +206,20 @@ public class HandleConstructor {
return true;
}
+ public enum SkipIfConstructorExists {
+ YES, NO, I_AM_BUILDER;
+ }
+
+ public void generateExtraNoArgsConstructor(EclipseNode typeNode, EclipseNode sourceNode) {
+ if (!isDirectDescendantOfObject(typeNode)) return;
+
+ Boolean v = typeNode.getAst().readConfiguration(ConfigurationKeys.NO_ARGS_CONSTRUCTOR_EXTRA_PRIVATE);
+ if (v == null || !v) return;
+
+ List<EclipseNode> fields = findFinalFields(typeNode);
+ generate(typeNode, AccessLevel.PRIVATE, fields, true, null, SkipIfConstructorExists.NO, Collections.<Annotation>emptyList(), sourceNode, true);
+ }
+
public void generateRequiredArgsConstructor(
EclipseNode typeNode, AccessLevel level, String staticName, SkipIfConstructorExists skipIfConstructorExists,
List<Annotation> onConstructor, EclipseNode sourceNode) {
@@ -218,14 +234,17 @@ public class HandleConstructor {
generateConstructor(typeNode, level, findAllFields(typeNode), false, staticName, skipIfConstructorExists, onConstructor, sourceNode);
}
- public enum SkipIfConstructorExists {
- YES, NO, I_AM_BUILDER;
- }
-
public void generateConstructor(
EclipseNode typeNode, AccessLevel level, List<EclipseNode> fields, boolean allToDefault, String staticName, SkipIfConstructorExists skipIfConstructorExists,
List<Annotation> onConstructor, EclipseNode sourceNode) {
+ generate(typeNode, level, fields, allToDefault, staticName, skipIfConstructorExists, onConstructor, sourceNode, false);
+ }
+
+ public void generate(
+ EclipseNode typeNode, AccessLevel level, List<EclipseNode> fields, boolean allToDefault, String staticName, SkipIfConstructorExists skipIfConstructorExists,
+ List<Annotation> onConstructor, EclipseNode sourceNode, boolean noArgs) {
+
ASTNode source = sourceNode.get();
boolean staticConstrRequired = staticName != null && !staticName.equals("");
@@ -257,6 +276,8 @@ public class HandleConstructor {
}
}
+ if (noArgs && noArgsConstructorExists(typeNode)) return;
+
ConstructorDeclaration constr = createConstructor(
staticConstrRequired ? AccessLevel.PRIVATE : level, typeNode, fields, allToDefault,
sourceNode, onConstructor);
@@ -267,6 +288,29 @@ public class HandleConstructor {
}
}
+ private static boolean noArgsConstructorExists(EclipseNode node) {
+ node = EclipseHandlerUtil.upToTypeNode(node);
+
+ if (node != null && node.get() instanceof TypeDeclaration) {
+ TypeDeclaration typeDecl = (TypeDeclaration)node.get();
+ if (typeDecl.methods != null) for (AbstractMethodDeclaration def : typeDecl.methods) {
+ if (def instanceof ConstructorDeclaration) {
+ Argument[] arguments = ((ConstructorDeclaration) def).arguments;
+ if (arguments == null || arguments.length == 0) return true;
+ }
+ }
+ }
+
+ for (EclipseNode child : node.down()) {
+ if (annotationTypeMatches(NoArgsConstructor.class, child)) return true;
+ if (annotationTypeMatches(RequiredArgsConstructor.class, child) && findRequiredFields(node).isEmpty()) return true;
+ if (annotationTypeMatches(AllArgsConstructor.class, child) && findAllFields(node).isEmpty()) return true;
+ }
+
+ return false;
+ }
+
+
private static final char[][] JAVA_BEANS_CONSTRUCTORPROPERTIES = new char[][] { "java".toCharArray(), "beans".toCharArray(), "ConstructorProperties".toCharArray() };
public static Annotation[] createConstructorProperties(ASTNode source, Collection<EclipseNode> fields) {
if (fields.isEmpty()) return null;
diff --git a/src/core/lombok/eclipse/handlers/HandleData.java b/src/core/lombok/eclipse/handlers/HandleData.java
index 5d92cd36..4011890d 100644
--- a/src/core/lombok/eclipse/handlers/HandleData.java
+++ b/src/core/lombok/eclipse/handlers/HandleData.java
@@ -79,5 +79,6 @@ public class HandleData extends EclipseAnnotationHandler<Data> {
handleConstructor.generateRequiredArgsConstructor(
typeNode, AccessLevel.PUBLIC, ann.staticConstructor(), SkipIfConstructorExists.YES,
Collections.<Annotation>emptyList(), annotationNode);
+ handleConstructor.generateExtraNoArgsConstructor(typeNode, annotationNode);
}
}
diff --git a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
index e30df698..c99b9b5f 100644
--- a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
+++ b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
@@ -157,12 +157,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
}
}
- boolean isDirectDescendantOfObject = true;
-
- if (typeDecl.superclass != null) {
- String p = typeDecl.superclass.toString();
- isDirectDescendantOfObject = p.equals("Object") || p.equals("java.lang.Object");
- }
+ boolean isDirectDescendantOfObject = isDirectDescendantOfObject(typeNode);
if (isDirectDescendantOfObject && callSuper) {
errorNode.addError("Generating equals/hashCode with a supercall to java.lang.Object is pointless.");
diff --git a/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java b/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java
index 754ddf47..c3a28f7f 100644
--- a/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java
+++ b/src/core/lombok/eclipse/handlers/HandleFieldNameConstants.java
@@ -49,7 +49,7 @@ import org.mangosdk.spi.ProviderFor;
@ProviderFor(EclipseAnnotationHandler.class)
public class HandleFieldNameConstants extends EclipseAnnotationHandler<FieldNameConstants> {
- public void generateFieldNameConstantsForType(EclipseNode typeNode, EclipseNode errorNode, AccessLevel level) {
+ public void generateFieldNameConstantsForType(EclipseNode typeNode, EclipseNode errorNode, AccessLevel level, String prefix, String suffix) {
TypeDeclaration typeDecl = null;
if (typeNode.get() instanceof TypeDeclaration) typeDecl = (TypeDeclaration) typeNode.get();
@@ -62,13 +62,13 @@ public class HandleFieldNameConstants extends EclipseAnnotationHandler<FieldName
}
for (EclipseNode field : typeNode.down()) {
- if (fieldQualifiesForFieldNameConstantsGeneration(field)) generateFieldNameConstantsForField(field, errorNode.get(), level);
+ if (fieldQualifiesForFieldNameConstantsGeneration(field)) generateFieldNameConstantsForField(field, errorNode.get(), level, prefix, suffix);
}
}
- private void generateFieldNameConstantsForField(EclipseNode fieldNode, ASTNode pos, AccessLevel level) {
+ private void generateFieldNameConstantsForField(EclipseNode fieldNode, ASTNode pos, AccessLevel level, String prefix, String suffix) {
if (hasAnnotation(FieldNameConstants.class, fieldNode)) return;
- createFieldNameConstantsForField(level, fieldNode, fieldNode, pos, false);
+ createFieldNameConstantsForField(level, prefix, suffix, fieldNode, fieldNode, pos, false);
}
private boolean fieldQualifiesForFieldNameConstantsGeneration(EclipseNode field) {
@@ -83,27 +83,33 @@ public class HandleFieldNameConstants extends EclipseAnnotationHandler<FieldName
EclipseNode node = annotationNode.up();
FieldNameConstants annotatationInstance = annotation.getInstance();
AccessLevel level = annotatationInstance.level();
+ String prefix = annotatationInstance.prefix();
+ String suffix = annotatationInstance.suffix();
+ if (prefix.equals(" CONFIG DEFAULT ")) prefix = annotationNode.getAst().readConfiguration(ConfigurationKeys.FIELD_NAME_CONSTANTS_PREFIX);
+ if (suffix.equals(" CONFIG DEFAULT ")) suffix = annotationNode.getAst().readConfiguration(ConfigurationKeys.FIELD_NAME_CONSTANTS_SUFFIX);
+ if (prefix == null) prefix = "FIELD_";
+ if (suffix == null) suffix = "";
if (node == null) return;
switch (node.getKind()) {
case FIELD:
- if (level != AccessLevel.NONE) createFieldNameConstantsForFields(level, annotationNode.upFromAnnotationToFields(), annotationNode, annotationNode.get(), true);
+ if (level != AccessLevel.NONE) createFieldNameConstantsForFields(level, prefix, suffix, annotationNode.upFromAnnotationToFields(), annotationNode, annotationNode.get(), true);
break;
case TYPE:
if (level == AccessLevel.NONE) {
annotationNode.addWarning("type-level '@FieldNameConstants' does not work with AccessLevel.NONE.");
return;
}
- generateFieldNameConstantsForType(node, annotationNode, level);
+ generateFieldNameConstantsForType(node, annotationNode, level, prefix, suffix);
break;
}
}
- private void createFieldNameConstantsForFields(AccessLevel level, Collection<EclipseNode> fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists) {
- for (EclipseNode fieldNode : fieldNodes) createFieldNameConstantsForField(level, fieldNode, errorNode, source, whineIfExists);
+ private void createFieldNameConstantsForFields(AccessLevel level, String prefix, String suffix, Collection<EclipseNode> fieldNodes, EclipseNode errorNode, ASTNode source, boolean whineIfExists) {
+ for (EclipseNode fieldNode : fieldNodes) createFieldNameConstantsForField(level, prefix, suffix, fieldNode, errorNode, source, whineIfExists);
}
- private void createFieldNameConstantsForField(AccessLevel level, EclipseNode fieldNode, EclipseNode errorNode, ASTNode source, boolean whineIfExists) {
+ private void createFieldNameConstantsForField(AccessLevel level, String prefix, String suffix, EclipseNode fieldNode, EclipseNode errorNode, ASTNode source, boolean whineIfExists) {
if (fieldNode.getKind() != Kind.FIELD) {
errorNode.addError("@FieldNameConstants is only supported on a class, an enum, or a field");
return;
@@ -111,7 +117,7 @@ public class HandleFieldNameConstants extends EclipseAnnotationHandler<FieldName
FieldDeclaration field = (FieldDeclaration) fieldNode.get();
String fieldName = new String(field.name);
- String constantName = HandlerUtil.camelCaseToConstant(fieldName);
+ String constantName = prefix + HandlerUtil.camelCaseToConstant(fieldName) + suffix;
if (constantName.equals(fieldName)) {
fieldNode.addWarning("Not generating constant for this field: The name of the constant would be equal to the name of this field.");
return;
diff --git a/src/core/lombok/eclipse/handlers/HandleLog.java b/src/core/lombok/eclipse/handlers/HandleLog.java
index c49030d8..8c7f7971 100644
--- a/src/core/lombok/eclipse/handlers/HandleLog.java
+++ b/src/core/lombok/eclipse/handlers/HandleLog.java
@@ -109,7 +109,7 @@ public class HandleLog {
private static FieldDeclaration createField(LoggingFramework framework, Annotation source, ClassLiteralAccess loggingType, String logFieldName, boolean useStatic, String loggerTopic) {
int pS = source.sourceStart, pE = source.sourceEnd;
- long p = (long)pS << 32 | pE;
+ long p = (long) pS << 32 | pE;
// private static final <loggerType> log = <factoryMethod>(<parameter>);
FieldDeclaration fieldDecl = new FieldDeclaration(logFieldName.toCharArray(), 0, -1);
@@ -126,13 +126,15 @@ public class HandleLog {
factoryMethodCall.selector = framework.getLoggerFactoryMethodName().toCharArray();
Expression parameter;
- if (loggerTopic == null || loggerTopic.trim().length() == 0) {
+ if (!framework.passTypeName) {
+ parameter = null;
+ } else if (loggerTopic == null || loggerTopic.trim().length() == 0) {
parameter = framework.createFactoryParameter(loggingType, source);
} else {
parameter = new StringLiteral(loggerTopic.toCharArray(), pS, pE, 0);
}
- factoryMethodCall.arguments = new Expression[] { parameter };
+ factoryMethodCall.arguments = parameter != null ? new Expression[] { parameter } : null;
factoryMethodCall.nameSourcePosition = p;
factoryMethodCall.sourceStart = pS;
factoryMethodCall.sourceEnd = factoryMethodCall.statementEnd = pE;
@@ -240,6 +242,17 @@ public class HandleLog {
}
}
+ /**
+ * Handles the {@link lombok.extern.flogger.Flogger} annotation for Eclipse.
+ */
+ @ProviderFor(EclipseAnnotationHandler.class)
+ public static class HandleFloggerLog extends EclipseAnnotationHandler<lombok.extern.flogger.Flogger> {
+ @Override public void handle(AnnotationValues<lombok.extern.flogger.Flogger> annotation, Annotation source, EclipseNode annotationNode) {
+ handleFlagUsage(annotationNode, ConfigurationKeys.LOG_FLOGGER_FLAG_USAGE, "@Flogger", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
+ processAnnotation(LoggingFramework.FLOGGER, annotation, source, annotationNode, "");
+ }
+ }
+
enum LoggingFramework {
// private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(TargetType.class);
COMMONS("org.apache.commons.logging.Log", "org.apache.commons.logging.LogFactory", "getLog", "@CommonsLog"),
@@ -278,18 +291,31 @@ public class HandleLog {
// private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(TargetType.class);
JBOSSLOG("org.jboss.logging.Logger", "org.jboss.logging.Logger", "getLogger", "@JBossLog"),
+
+ // private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
+ FLOGGER("com.google.common.flogger.FluentLogger", "com.google.common.flogger.FluentLogger", "forEnclosingClass", "@Flogger", false),
;
private final String loggerTypeName;
private final String loggerFactoryTypeName;
private final String loggerFactoryMethodName;
private final String annotationAsString;
-
+ private final boolean passTypeName;
+
+ LoggingFramework(String loggerTypeName, String loggerFactoryTypeName, String loggerFactoryMethodName, String annotationAsString, boolean passTypeName) {
+ this.loggerTypeName = loggerTypeName;
+ this.loggerFactoryTypeName = loggerFactoryTypeName;
+ this.loggerFactoryMethodName = loggerFactoryMethodName;
+ this.annotationAsString = annotationAsString;
+ this.passTypeName = passTypeName;
+ }
+
LoggingFramework(String loggerTypeName, String loggerFactoryTypeName, String loggerFactoryMethodName, String annotationAsString) {
this.loggerTypeName = loggerTypeName;
this.loggerFactoryTypeName = loggerFactoryTypeName;
this.loggerFactoryMethodName = loggerFactoryMethodName;
this.annotationAsString = annotationAsString;
+ this.passTypeName = true;
}
final String getAnnotationAsString() {
@@ -308,7 +334,7 @@ public class HandleLog {
return loggerFactoryMethodName;
}
- Expression createFactoryParameter(ClassLiteralAccess loggingType, Annotation source){
+ Expression createFactoryParameter(ClassLiteralAccess loggingType, Annotation source) {
TypeReference copy = copyType(loggingType.type, source);
ClassLiteralAccess result = new ClassLiteralAccess(source.sourceEnd, copy);
setGeneratedBy(result, source);
diff --git a/src/core/lombok/eclipse/handlers/HandleValue.java b/src/core/lombok/eclipse/handlers/HandleValue.java
index bd93a547..2e0338a8 100644
--- a/src/core/lombok/eclipse/handlers/HandleValue.java
+++ b/src/core/lombok/eclipse/handlers/HandleValue.java
@@ -91,5 +91,6 @@ public class HandleValue extends EclipseAnnotationHandler<Value> {
handleToString.generateToStringForType(typeNode, annotationNode);
handleConstructor.generateAllArgsConstructor(typeNode, AccessLevel.PUBLIC, ann.staticConstructor(), SkipIfConstructorExists.YES,
Collections.<Annotation>emptyList(), annotationNode);
+ handleConstructor.generateExtraNoArgsConstructor(typeNode, annotationNode);
}
}
diff --git a/src/core/lombok/experimental/FieldNameConstants.java b/src/core/lombok/experimental/FieldNameConstants.java
index 41b33ac7..31c2970c 100644
--- a/src/core/lombok/experimental/FieldNameConstants.java
+++ b/src/core/lombok/experimental/FieldNameConstants.java
@@ -35,4 +35,6 @@ import lombok.AccessLevel;
@Retention(RetentionPolicy.SOURCE)
public @interface FieldNameConstants {
lombok.AccessLevel level() default AccessLevel.PUBLIC;
+ String prefix() default " CONFIG DEFAULT ";
+ String suffix() default " CONFIG DEFAULT ";
}
diff --git a/src/core/lombok/extern/apachecommons/CommonsLog.java b/src/core/lombok/extern/apachecommons/CommonsLog.java
index 04d5ef93..fa3d6f09 100644
--- a/src/core/lombok/extern/apachecommons/CommonsLog.java
+++ b/src/core/lombok/extern/apachecommons/CommonsLog.java
@@ -56,6 +56,7 @@ import java.lang.annotation.Target;
* @see lombok.extern.slf4j.Slf4j &#64;Slf4j
* @see lombok.extern.slf4j.XSlf4j &#64;XSlf4j
* @see lombok.extern.jbosslog.JBossLog &#64;JBossLog
+ * @see lombok.extern.flogger.Flogger &#64;Flogger
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
diff --git a/src/core/lombok/extern/flogger/Flogger.java b/src/core/lombok/extern/flogger/Flogger.java
new file mode 100644
index 00000000..ecbfd28c
--- /dev/null
+++ b/src/core/lombok/extern/flogger/Flogger.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2018 The Project Lombok Authors.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok.extern.flogger;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Causes lombok to generate a logger field.
+ * <p>
+ * Complete documentation is found at <a href="https://projectlombok.org/features/Log">the project lombok features page for lombok log annotations</a>.
+ * <p>
+ * Example:
+ * <pre>
+ * &#64;Flogger
+ * public class LogExample {
+ * }
+ * </pre>
+ *
+ * will generate:
+ *
+ * <pre>
+ * public class LogExample {
+ * private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
+ * }
+ * </pre>
+ *
+ * This annotation is valid for classes and enumerations.<br>
+ * @see <a href="https://google.github.io/flogger/">com.google.common.flogger</a>
+ * @see lombok.extern.apachecommons.CommonsLog &#64;CommonsLog
+ * @see lombok.extern.java.Log &#64;Log
+ * @see lombok.extern.log4j.Log4j &#64;Log4j
+ * @see lombok.extern.log4j.Log4j2 &#64;Log4j2
+ * @see lombok.extern.slf4j.Slf4j &#64;Slf4j
+ * @see lombok.extern.slf4j.XSlf4j &#64;XSlf4j
+ * @see lombok.extern.jbosslog.JBossLog &#64;JBossLog
+ */
+@Retention(RetentionPolicy.SOURCE)
+@Target(ElementType.TYPE)
+public @interface Flogger {
+}
diff --git a/src/core/lombok/extern/java/Log.java b/src/core/lombok/extern/java/Log.java
index 553b7c4a..9a1ee412 100644
--- a/src/core/lombok/extern/java/Log.java
+++ b/src/core/lombok/extern/java/Log.java
@@ -55,6 +55,7 @@ import java.lang.annotation.Target;
* @see lombok.extern.slf4j.Slf4j &#64;Slf4j
* @see lombok.extern.slf4j.XSlf4j &#64;XSlf4j
* @see lombok.extern.jbosslog.JBossLog &#64;JBossLog
+ * @see lombok.extern.flogger.Flogger &#64;Flogger
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
diff --git a/src/core/lombok/extern/jbosslog/JBossLog.java b/src/core/lombok/extern/jbosslog/JBossLog.java
index ea520aea..684585e0 100644
--- a/src/core/lombok/extern/jbosslog/JBossLog.java
+++ b/src/core/lombok/extern/jbosslog/JBossLog.java
@@ -53,8 +53,9 @@ import java.lang.annotation.Target;
* @see lombok.extern.java.Log &#64;Log
* @see lombok.extern.log4j.Log4j &#64;Log4j
* @see lombok.extern.log4j.Log4j2 &#64;Log4j2
+ * @see lombok.extern.slf4j.Slf4j &#64;Slf4j
* @see lombok.extern.slf4j.XSlf4j &#64;XSlf4j
- * @see lombok.extern.jbosslog.JBossLog &#64;JBossLog
+ * @see lombok.extern.flogger.Flogger &#64;Flogger
* */
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
diff --git a/src/core/lombok/extern/log4j/Log4j.java b/src/core/lombok/extern/log4j/Log4j.java
index ee719407..249ef71a 100644
--- a/src/core/lombok/extern/log4j/Log4j.java
+++ b/src/core/lombok/extern/log4j/Log4j.java
@@ -56,6 +56,7 @@ import java.lang.annotation.Target;
* @see lombok.extern.slf4j.Slf4j &#64;Slf4j
* @see lombok.extern.slf4j.XSlf4j &#64;XSlf4j
* @see lombok.extern.jbosslog.JBossLog &#64;JBossLog
+ * @see lombok.extern.flogger.Flogger &#64;Flogger
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
diff --git a/src/core/lombok/extern/log4j/Log4j2.java b/src/core/lombok/extern/log4j/Log4j2.java
index 4a5b166c..a6aa90c0 100644
--- a/src/core/lombok/extern/log4j/Log4j2.java
+++ b/src/core/lombok/extern/log4j/Log4j2.java
@@ -56,6 +56,7 @@ import java.lang.annotation.Target;
* @see lombok.extern.slf4j.Slf4j &#64;Slf4j
* @see lombok.extern.slf4j.XSlf4j &#64;XSlf4j
* @see lombok.extern.jbosslog.JBossLog &#64;JBossLog
+ * @see lombok.extern.flogger.Flogger &#64;Flogger
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
diff --git a/src/core/lombok/extern/slf4j/Slf4j.java b/src/core/lombok/extern/slf4j/Slf4j.java
index 24586d43..347d81d2 100644
--- a/src/core/lombok/extern/slf4j/Slf4j.java
+++ b/src/core/lombok/extern/slf4j/Slf4j.java
@@ -55,6 +55,7 @@ import java.lang.annotation.Target;
* @see lombok.extern.log4j.Log4j2 &#64;Log4j2
* @see lombok.extern.slf4j.XSlf4j &#64;XSlf4j
* @see lombok.extern.jbosslog.JBossLog &#64;JBossLog
+ * @see lombok.extern.flogger.Flogger &#64;Flogger
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
diff --git a/src/core/lombok/extern/slf4j/XSlf4j.java b/src/core/lombok/extern/slf4j/XSlf4j.java
index 85a0fdd8..4d53a1eb 100644
--- a/src/core/lombok/extern/slf4j/XSlf4j.java
+++ b/src/core/lombok/extern/slf4j/XSlf4j.java
@@ -55,6 +55,7 @@ import java.lang.annotation.Target;
* @see lombok.extern.log4j.Log4j2 &#64;Log4j2
* @see lombok.extern.slf4j.Slf4j &#64;Slf4j
* @see lombok.extern.jbosslog.JBossLog &#64;JBossLog
+ * @see lombok.extern.flogger.Flogger &#64;Flogger
*/
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java
index dca25ee7..32eb43b2 100644
--- a/src/core/lombok/javac/handlers/HandleConstructor.java
+++ b/src/core/lombok/javac/handlers/HandleConstructor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2014 The Project Lombok Authors.
+ * Copyright (C) 2010-2018 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -22,22 +22,8 @@
package lombok.javac.handlers;
import static lombok.core.handlers.HandlerUtil.*;
-import static lombok.javac.handlers.JavacHandlerUtil.*;
import static lombok.javac.Javac.*;
-
-import lombok.AccessLevel;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.ConfigurationKeys;
-import lombok.NoArgsConstructor;
-import lombok.RequiredArgsConstructor;
-import lombok.core.AnnotationValues;
-import lombok.core.AST.Kind;
-import lombok.delombok.LombokOptionsFactory;
-import lombok.javac.Javac;
-import lombok.javac.JavacAnnotationHandler;
-import lombok.javac.JavacNode;
-import lombok.javac.JavacTreeMaker;
+import static lombok.javac.handlers.JavacHandlerUtil.*;
import org.mangosdk.spi.ProviderFor;
@@ -61,6 +47,21 @@ import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.ConfigurationKeys;
+import lombok.NoArgsConstructor;
+import lombok.RequiredArgsConstructor;
+import lombok.core.AST.Kind;
+import lombok.core.AnnotationValues;
+import lombok.delombok.LombokOptionsFactory;
+import lombok.javac.Javac;
+import lombok.javac.JavacAnnotationHandler;
+import lombok.javac.JavacNode;
+import lombok.javac.JavacTreeMaker;
+import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
+
public class HandleConstructor {
@ProviderFor(JavacAnnotationHandler.class)
public static class HandleNoArgsConstructor extends JavacAnnotationHandler<NoArgsConstructor> {
@@ -191,19 +192,33 @@ public class HandleConstructor {
return true;
}
- public void generateRequiredArgsConstructor(JavacNode typeNode, AccessLevel level, String staticName, SkipIfConstructorExists skipIfConstructorExists, JavacNode source) {
- generateConstructor(typeNode, level, List.<JCAnnotation>nil(), findRequiredFields(typeNode), false, staticName, skipIfConstructorExists, source);
- }
-
public enum SkipIfConstructorExists {
YES, NO, I_AM_BUILDER;
}
+ public void generateExtraNoArgsConstructor(JavacNode typeNode, JavacNode source) {
+ if (!isDirectDescendantOfObject(typeNode)) return;
+
+ Boolean v = typeNode.getAst().readConfiguration(ConfigurationKeys.NO_ARGS_CONSTRUCTOR_EXTRA_PRIVATE);
+ if (v == null || !v) return;
+
+ List<JavacNode> fields = findFinalFields(typeNode);
+ generate(typeNode, AccessLevel.PRIVATE, List.<JCAnnotation>nil(), fields, true, null, SkipIfConstructorExists.NO, source, true);
+ }
+
+ public void generateRequiredArgsConstructor(JavacNode typeNode, AccessLevel level, String staticName, SkipIfConstructorExists skipIfConstructorExists, JavacNode source) {
+ generateConstructor(typeNode, level, List.<JCAnnotation>nil(), findRequiredFields(typeNode), false, staticName, skipIfConstructorExists, source);
+ }
+
public void generateAllArgsConstructor(JavacNode typeNode, AccessLevel level, String staticName, SkipIfConstructorExists skipIfConstructorExists, JavacNode source) {
generateConstructor(typeNode, level, List.<JCAnnotation>nil(), findAllFields(typeNode), false, staticName, skipIfConstructorExists, source);
}
public void generateConstructor(JavacNode typeNode, AccessLevel level, List<JCAnnotation> onConstructor, List<JavacNode> fields, boolean allToDefault, String staticName, SkipIfConstructorExists skipIfConstructorExists, JavacNode source) {
+ generate(typeNode, level, onConstructor, fields, allToDefault, staticName, skipIfConstructorExists, source, false);
+ }
+
+ private void generate(JavacNode typeNode, AccessLevel level, List<JCAnnotation> onConstructor, List<JavacNode> fields, boolean allToDefault, String staticName, SkipIfConstructorExists skipIfConstructorExists, JavacNode source, boolean noArgs) {
boolean staticConstrRequired = staticName != null && !staticName.equals("");
if (skipIfConstructorExists != SkipIfConstructorExists.NO && constructorExists(typeNode) != MemberExistsResult.NOT_EXISTS) return;
@@ -232,6 +247,8 @@ public class HandleConstructor {
}
}
+ if (noArgs && noArgsConstructorExists(typeNode)) return;
+
JCMethodDecl constr = createConstructor(staticConstrRequired ? AccessLevel.PRIVATE : level, onConstructor, typeNode, fields, allToDefault, source);
ListBuffer<Type> argTypes = new ListBuffer<Type>();
for (JavacNode fieldNode : fields) {
@@ -252,6 +269,27 @@ public class HandleConstructor {
}
}
+ private static boolean noArgsConstructorExists(JavacNode node) {
+ node = upToTypeNode(node);
+
+ if (node != null && node.get() instanceof JCClassDecl) {
+ for (JCTree def : ((JCClassDecl) node.get()).defs) {
+ if (def instanceof JCMethodDecl) {
+ JCMethodDecl md = (JCMethodDecl) def;
+ if (md.name.contentEquals("<init>") && md.params.size() == 0) return true;
+ }
+ }
+ }
+
+ for (JavacNode child : node.down()) {
+ if (annotationTypeMatches(NoArgsConstructor.class, child)) return true;
+ if (annotationTypeMatches(RequiredArgsConstructor.class, child) && findRequiredFields(node).isEmpty()) return true;
+ if (annotationTypeMatches(AllArgsConstructor.class, child) && findAllFields(node).isEmpty()) return true;
+ }
+
+ return false;
+ }
+
public static void addConstructorProperties(JCModifiers mods, JavacNode node, List<JavacNode> fields) {
if (fields.isEmpty()) return;
JavacTreeMaker maker = node.getTreeMaker();
diff --git a/src/core/lombok/javac/handlers/HandleData.java b/src/core/lombok/javac/handlers/HandleData.java
index 94b6c3e1..15c9c9e7 100644
--- a/src/core/lombok/javac/handlers/HandleData.java
+++ b/src/core/lombok/javac/handlers/HandleData.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2014 The Project Lombok Authors.
+ * Copyright (C) 2009-2018 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -61,7 +61,9 @@ public class HandleData extends JavacAnnotationHandler<Data> {
String staticConstructorName = annotation.getInstance().staticConstructor();
+ // TODO move this to the end OR move it to the top in eclipse.
handleConstructor.generateRequiredArgsConstructor(typeNode, AccessLevel.PUBLIC, staticConstructorName, SkipIfConstructorExists.YES, annotationNode);
+ handleConstructor.generateExtraNoArgsConstructor(typeNode, annotationNode);
handleGetter.generateGetterForType(typeNode, annotationNode, AccessLevel.PUBLIC, true, List.<JCAnnotation>nil());
handleSetter.generateSetterForType(typeNode, annotationNode, AccessLevel.PUBLIC, true, List.<JCAnnotation>nil(), List.<JCAnnotation>nil());
handleEqualsAndHashCode.generateEqualsAndHashCodeForType(typeNode, annotationNode);
diff --git a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
index 12071cfd..aa0fe633 100644
--- a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
+++ b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
@@ -21,7 +21,7 @@
*/
package lombok.javac.handlers;
-import static lombok.core.handlers.HandlerUtil.*;
+import static lombok.core.handlers.HandlerUtil.handleFlagUsage;
import static lombok.javac.Javac.*;
import static lombok.javac.handlers.JavacHandlerUtil.*;
@@ -29,20 +29,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import lombok.ConfigurationKeys;
-import lombok.EqualsAndHashCode;
-import lombok.core.AST.Kind;
-import lombok.core.configuration.CallSuperType;
-import lombok.core.AnnotationValues;
-import lombok.core.handlers.HandlerUtil;
-import lombok.core.handlers.InclusionExclusionUtils;
-import lombok.core.handlers.InclusionExclusionUtils.Included;
-import lombok.javac.Javac;
-import lombok.javac.JavacAnnotationHandler;
-import lombok.javac.JavacNode;
-import lombok.javac.JavacTreeMaker;
-import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
-
import org.mangosdk.spi.ProviderFor;
import com.sun.tools.javac.code.BoundKind;
@@ -67,6 +53,20 @@ import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
+import lombok.ConfigurationKeys;
+import lombok.EqualsAndHashCode;
+import lombok.core.AST.Kind;
+import lombok.core.AnnotationValues;
+import lombok.core.configuration.CallSuperType;
+import lombok.core.handlers.HandlerUtil;
+import lombok.core.handlers.HandlerUtil.FieldAccess;
+import lombok.core.handlers.InclusionExclusionUtils;
+import lombok.core.handlers.InclusionExclusionUtils.Included;
+import lombok.javac.JavacAnnotationHandler;
+import lombok.javac.JavacNode;
+import lombok.javac.JavacTreeMaker;
+import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
+
/**
* Handles the {@code lombok.EqualsAndHashCode} annotation for javac.
*/
@@ -122,7 +122,6 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
return;
}
- boolean isDirectDescendantOfObject = true;
boolean implicitCallSuper = callSuper == null;
if (callSuper == null) {
try {
@@ -132,11 +131,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
}
}
- JCTree extending = Javac.getExtendsClause((JCClassDecl)typeNode.get());
- if (extending != null) {
- String p = extending.toString();
- isDirectDescendantOfObject = p.equals("Object") || p.equals("java.lang.Object");
- }
+ boolean isDirectDescendantOfObject = isDirectDescendantOfObject(typeNode);
if (isDirectDescendantOfObject && callSuper) {
source.addError("Generating equals/hashCode with a supercall to java.lang.Object is pointless.");
diff --git a/src/core/lombok/javac/handlers/HandleFieldNameConstants.java b/src/core/lombok/javac/handlers/HandleFieldNameConstants.java
index 089d225d..8ff136fc 100644
--- a/src/core/lombok/javac/handlers/HandleFieldNameConstants.java
+++ b/src/core/lombok/javac/handlers/HandleFieldNameConstants.java
@@ -49,7 +49,7 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
@ProviderFor(JavacAnnotationHandler.class)
public class HandleFieldNameConstants extends JavacAnnotationHandler<FieldNameConstants> {
- public void generateFieldNameConstantsForType(JavacNode typeNode, JavacNode errorNode, AccessLevel level) {
+ public void generateFieldNameConstantsForType(JavacNode typeNode, JavacNode errorNode, AccessLevel level, String prefix, String suffix) {
JCClassDecl typeDecl = null;
if (typeNode.get() instanceof JCClassDecl) typeDecl = (JCClassDecl) typeNode.get();
@@ -62,13 +62,13 @@ public class HandleFieldNameConstants extends JavacAnnotationHandler<FieldNameCo
}
for (JavacNode field : typeNode.down()) {
- if (fieldQualifiesForFieldNameConstantsGeneration(field)) generateFieldNameConstantsForField(field, errorNode.get(), level);
+ if (fieldQualifiesForFieldNameConstantsGeneration(field)) generateFieldNameConstantsForField(field, errorNode.get(), level, prefix, suffix);
}
}
- private void generateFieldNameConstantsForField(JavacNode fieldNode, DiagnosticPosition pos, AccessLevel level) {
+ private void generateFieldNameConstantsForField(JavacNode fieldNode, DiagnosticPosition pos, AccessLevel level, String prefix, String suffix) {
if (hasAnnotation(FieldNameConstants.class, fieldNode)) return;
- createFieldNameConstantsForField(level, fieldNode, fieldNode, false);
+ createFieldNameConstantsForField(level, prefix, suffix, fieldNode, fieldNode, false);
}
private boolean fieldQualifiesForFieldNameConstantsGeneration(JavacNode field) {
@@ -88,26 +88,32 @@ public class HandleFieldNameConstants extends JavacAnnotationHandler<FieldNameCo
JavacNode node = annotationNode.up();
FieldNameConstants annotatationInstance = annotation.getInstance();
AccessLevel level = annotatationInstance.level();
+ String prefix = annotatationInstance.prefix();
+ String suffix = annotatationInstance.suffix();
+ if (prefix.equals(" CONFIG DEFAULT ")) prefix = annotationNode.getAst().readConfiguration(ConfigurationKeys.FIELD_NAME_CONSTANTS_PREFIX);
+ if (suffix.equals(" CONFIG DEFAULT ")) suffix = annotationNode.getAst().readConfiguration(ConfigurationKeys.FIELD_NAME_CONSTANTS_SUFFIX);
+ if (prefix == null) prefix = "FIELD_";
+ if (suffix == null) suffix = "";
if (node == null) return;
switch (node.getKind()) {
case FIELD:
- if (level != AccessLevel.NONE) createFieldNameConstantsForFields(level, fields, annotationNode, annotationNode, true);
+ if (level != AccessLevel.NONE) createFieldNameConstantsForFields(level, prefix, suffix, fields, annotationNode, annotationNode, true);
break;
case TYPE:
if (level == AccessLevel.NONE) {
annotationNode.addWarning("type-level '@FieldNameConstants' does not work with AccessLevel.NONE.");
return;
}
- generateFieldNameConstantsForType(node, annotationNode, level);
+ generateFieldNameConstantsForType(node, annotationNode, level, prefix, suffix);
break;
}
}
- private void createFieldNameConstantsForFields(AccessLevel level, Collection<JavacNode> fieldNodes, JavacNode annotationNode, JavacNode errorNode, boolean whineIfExists) {
- for (JavacNode fieldNode : fieldNodes) createFieldNameConstantsForField(level, fieldNode, errorNode, whineIfExists);
+ private void createFieldNameConstantsForFields(AccessLevel level, String prefix, String suffix, Collection<JavacNode> fieldNodes, JavacNode annotationNode, JavacNode errorNode, boolean whineIfExists) {
+ for (JavacNode fieldNode : fieldNodes) createFieldNameConstantsForField(level, prefix, suffix, fieldNode, errorNode, whineIfExists);
}
- private void createFieldNameConstantsForField(AccessLevel level, JavacNode fieldNode, JavacNode source, boolean whineIfExists) {
+ private void createFieldNameConstantsForField(AccessLevel level, String prefix, String suffix, JavacNode fieldNode, JavacNode source, boolean whineIfExists) {
if (fieldNode.getKind() != Kind.FIELD) {
source.addError("@FieldNameConstants is only supported on a class, an enum, or a field");
return;
@@ -115,7 +121,7 @@ public class HandleFieldNameConstants extends JavacAnnotationHandler<FieldNameCo
JCVariableDecl field = (JCVariableDecl) fieldNode.get();
String fieldName = field.name.toString();
- String constantName = HandlerUtil.camelCaseToConstant(fieldName);
+ String constantName = prefix + HandlerUtil.camelCaseToConstant(fieldName) + suffix;
if (constantName.equals(fieldName)) {
fieldNode.addWarning("Not generating constant for this field: The name of the constant would be equal to the name of this field.");
return;
diff --git a/src/core/lombok/javac/handlers/HandleLog.java b/src/core/lombok/javac/handlers/HandleLog.java
index d0d709e3..6d742e76 100644
--- a/src/core/lombok/javac/handlers/HandleLog.java
+++ b/src/core/lombok/javac/handlers/HandleLog.java
@@ -91,16 +91,18 @@ public class HandleLog {
// private static final <loggerType> log = <factoryMethod>(<parameter>);
JCExpression loggerType = chainDotsString(typeNode, framework.getLoggerTypeName());
JCExpression factoryMethod = chainDotsString(typeNode, framework.getLoggerFactoryMethodName());
-
+
JCExpression loggerName;
- if (loggerTopic == null || loggerTopic.trim().length() == 0) {
+ if (!framework.passTypeName) {
+ loggerName = null;
+ } else if (loggerTopic == null || loggerTopic.trim().length() == 0) {
loggerName = framework.createFactoryParameter(typeNode, loggingType);
} else {
loggerName = maker.Literal(loggerTopic);
}
-
- JCMethodInvocation factoryMethodCall = maker.Apply(List.<JCExpression>nil(), factoryMethod, List.<JCExpression>of(loggerName));
-
+
+ JCMethodInvocation factoryMethodCall = maker.Apply(List.<JCExpression>nil(), factoryMethod, loggerName != null ? List.<JCExpression>of(loggerName) : List.<JCExpression>nil());
+
JCVariableDecl fieldDecl = recursiveSetGeneratedBy(maker.VarDef(
maker.Modifiers(Flags.PRIVATE | Flags.FINAL | (useStatic ? Flags.STATIC : 0)),
typeNode.toName(logFieldName), loggerType, factoryMethodCall), source, typeNode.getContext());
@@ -186,6 +188,17 @@ public class HandleLog {
}
}
+ /**
+ * Handles the {@link lombok.extern.flogger.Flogger} annotation for javac.
+ */
+ @ProviderFor(JavacAnnotationHandler.class)
+ public static class HandleFloggerLog extends JavacAnnotationHandler<lombok.extern.flogger.Flogger> {
+ @Override public void handle(AnnotationValues<lombok.extern.flogger.Flogger> annotation, JCAnnotation ast, JavacNode annotationNode) {
+ handleFlagUsage(annotationNode, ConfigurationKeys.LOG_FLOGGER_FLAG_USAGE, "@Flogger", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log");
+ processAnnotation(LoggingFramework.FLOGGER, annotation, annotationNode, "");
+ }
+ }
+
enum LoggingFramework {
// private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(TargetType.class);
COMMONS(lombok.extern.apachecommons.CommonsLog.class, "org.apache.commons.logging.Log", "org.apache.commons.logging.LogFactory.getLog"),
@@ -212,17 +225,29 @@ public class HandleLog {
XSLF4J(lombok.extern.slf4j.XSlf4j.class, "org.slf4j.ext.XLogger", "org.slf4j.ext.XLoggerFactory.getXLogger"),
// private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(TargetType.class);
- JBOSSLOG(lombok.extern.jbosslog.JBossLog.class, "org.jboss.logging.Logger", "org.jboss.logging.Logger.getLogger")
+ JBOSSLOG(lombok.extern.jbosslog.JBossLog.class, "org.jboss.logging.Logger", "org.jboss.logging.Logger.getLogger"),
+
+ // private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
+ FLOGGER(lombok.extern.flogger.Flogger.class, "com.google.common.flogger.FluentLogger", "com.google.common.flogger.FluentLogger.forEnclosingClass", false),
;
private final Class<? extends Annotation> annotationClass;
private final String loggerTypeName;
private final String loggerFactoryName;
+ private final boolean passTypeName;
+
+ LoggingFramework(Class<? extends Annotation> annotationClass, String loggerTypeName, String loggerFactoryName, boolean passTypeName) {
+ this.annotationClass = annotationClass;
+ this.loggerTypeName = loggerTypeName;
+ this.loggerFactoryName = loggerFactoryName;
+ this.passTypeName = passTypeName;
+ }
LoggingFramework(Class<? extends Annotation> annotationClass, String loggerTypeName, String loggerFactoryName) {
this.annotationClass = annotationClass;
this.loggerTypeName = loggerTypeName;
this.loggerFactoryName = loggerFactoryName;
+ this.passTypeName = true;
}
final Class<? extends Annotation> getAnnotationClass() {
diff --git a/src/core/lombok/javac/handlers/HandleValue.java b/src/core/lombok/javac/handlers/HandleValue.java
index f85e058e..abc5a5ca 100644
--- a/src/core/lombok/javac/handlers/HandleValue.java
+++ b/src/core/lombok/javac/handlers/HandleValue.java
@@ -77,6 +77,7 @@ public class HandleValue extends JavacAnnotationHandler<Value> {
}
handleFieldDefaults.generateFieldDefaultsForType(typeNode, annotationNode, AccessLevel.PRIVATE, true, true);
handleConstructor.generateAllArgsConstructor(typeNode, AccessLevel.PUBLIC, staticConstructorName, SkipIfConstructorExists.YES, annotationNode);
+ handleConstructor.generateExtraNoArgsConstructor(typeNode, annotationNode);
handleGetter.generateGetterForType(typeNode, annotationNode, AccessLevel.PUBLIC, true, List.<JCAnnotation>nil());
handleEqualsAndHashCode.generateEqualsAndHashCodeForType(typeNode, annotationNode);
handleToString.generateToStringForType(typeNode, annotationNode);
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index b5bc6e6b..f335cf94 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -1813,4 +1813,12 @@ public class JavacHandlerUtil {
docComments.put(from.get(), filtered[1]);
}
}
+
+ public static boolean isDirectDescendantOfObject(JavacNode typeNode) {
+ if (!(typeNode.get() instanceof JCClassDecl)) throw new IllegalArgumentException("not a type node");
+ JCTree extending = Javac.getExtendsClause((JCClassDecl)typeNode.get());
+ if (extending == null) return true;
+ String p = extending.toString();
+ return p.equals("Object") || p.equals("java.lang.Object");
+ }
}
diff --git a/src/core9/module-info.java b/src/core9/module-info.java
index 87f819e2..f4d5815f 100644
--- a/src/core9/module-info.java
+++ b/src/core9/module-info.java
@@ -31,6 +31,7 @@ module lombok {
exports lombok.extern.jbosslog;
exports lombok.extern.log4j;
exports lombok.extern.slf4j;
+ exports lombok.extern.flogger;
provides javax.annotation.processing.Processor with lombok.launch.AnnotationProcessorHider.AnnotationProcessor;
provides org.mapstruct.ap.spi.AstModifyingAnnotationProcessor with lombok.launch.AnnotationProcessorHider.AstModificationNotifier;
diff --git a/src/delombok/lombok/delombok/Delombok.java b/src/delombok/lombok/delombok/Delombok.java
index a53f5a10..f5372fbb 100644
--- a/src/delombok/lombok/delombok/Delombok.java
+++ b/src/delombok/lombok/delombok/Delombok.java
@@ -147,7 +147,6 @@ public class Delombok {
private boolean nocopy;
@Description("Output only changed files (implies -n)")
- @Shorthand("c")
private boolean onlyChanged;
private boolean help;
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index 6ed1e950..4e6a6a55 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -146,6 +146,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
classpath.add("lib/test/org.jboss.logging-jboss-logging.jar");
classpath.add("lib/test/com.google.guava-guava.jar");
classpath.add("lib/test/com.google.code.findbugs-findbugs.jar");
+ classpath.add("lib/test/com.google.flogger-flogger.jar");
return new FileSystem(classpath.toArray(new String[0]), new String[] {file.getAbsolutePath()}, "UTF-8");
}
}
diff --git a/test/transform/resource/after-delombok/DataConfiguration.java b/test/transform/resource/after-delombok/DataConfiguration.java
index b71e1c81..6771a6a7 100644
--- a/test/transform/resource/after-delombok/DataConfiguration.java
+++ b/test/transform/resource/after-delombok/DataConfiguration.java
@@ -5,6 +5,10 @@ class DataConfiguration {
this.x = x;
}
@java.lang.SuppressWarnings("all")
+ private DataConfiguration() {
+ this.x = 0;
+ }
+ @java.lang.SuppressWarnings("all")
public int getX() {
return this.x;
}
diff --git a/test/transform/resource/after-delombok/FieldNameConstantsBasic.java b/test/transform/resource/after-delombok/FieldNameConstantsBasic.java
index de5d68c6..4e547aa5 100644
--- a/test/transform/resource/after-delombok/FieldNameConstantsBasic.java
+++ b/test/transform/resource/after-delombok/FieldNameConstantsBasic.java
@@ -1,6 +1,6 @@
public class FieldNameConstantsBasic {
- protected static final java.lang.String I_AM_A_DVD_PLAYER = "iAmADvdPlayer";
- public static final java.lang.String BUT_PRINT_ME_PLEASE = "butPrintMePlease";
+ protected static final java.lang.String FIELD_I_AM_A_DVD_PLAYER = "iAmADvdPlayer";
+ public static final java.lang.String FIELD_BUT_PRINT_ME_PLEASE = "butPrintMePlease";
String iAmADvdPlayer;
int $skipMe;
static double skipMeToo;
diff --git a/test/transform/resource/after-delombok/FieldNameConstantsConfigKeys.java b/test/transform/resource/after-delombok/FieldNameConstantsConfigKeys.java
new file mode 100644
index 00000000..c71b9264
--- /dev/null
+++ b/test/transform/resource/after-delombok/FieldNameConstantsConfigKeys.java
@@ -0,0 +1,4 @@
+public class FieldNameConstantsConfigKeys {
+ public static final java.lang.String I_AM_A_DVD_PLAYER_SFX = "iAmADvdPlayer";
+ String iAmADvdPlayer;
+}
diff --git a/test/transform/resource/after-delombok/FieldNameConstantsWeird.java b/test/transform/resource/after-delombok/FieldNameConstantsWeird.java
index a256f5ba..6940f628 100644
--- a/test/transform/resource/after-delombok/FieldNameConstantsWeird.java
+++ b/test/transform/resource/after-delombok/FieldNameConstantsWeird.java
@@ -1,4 +1,6 @@
public class FieldNameConstantsWeird {
+ public static final java.lang.String FIELD_AZ = "A";
String iAmADvdPlayer;
String X;
+ String A;
}
diff --git a/test/transform/resource/after-delombok/LoggerFlogger.java b/test/transform/resource/after-delombok/LoggerFlogger.java
new file mode 100644
index 00000000..41d49fe4
--- /dev/null
+++ b/test/transform/resource/after-delombok/LoggerFlogger.java
@@ -0,0 +1,14 @@
+class LoggerFlogger {
+ @java.lang.SuppressWarnings("all")
+ private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
+}
+class LoggerFloggerWithImport {
+ @java.lang.SuppressWarnings("all")
+ private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
+}
+class LoggerFloggerOuter {
+ static class Inner {
+ @java.lang.SuppressWarnings("all")
+ private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
+ }
+}
diff --git a/test/transform/resource/after-delombok/NoPrivateNoArgsConstructor.java b/test/transform/resource/after-delombok/NoPrivateNoArgsConstructor.java
new file mode 100644
index 00000000..b354a85d
--- /dev/null
+++ b/test/transform/resource/after-delombok/NoPrivateNoArgsConstructor.java
@@ -0,0 +1,73 @@
+public class NoPrivateNoArgsConstructor {
+ public static class NoPrivateNoArgsConstructorData {
+ private final int i;
+ @java.lang.SuppressWarnings("all")
+ public NoPrivateNoArgsConstructorData(final int i) {
+ this.i = i;
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getI() {
+ return this.i;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData)) return false;
+ final NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData other = (NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (this.getI() != other.getI()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.getI();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData(i=" + this.getI() + ")";
+ }
+ }
+ public static final class NoPrivateNoArgsConstructorValue {
+ private final int i;
+ @java.lang.SuppressWarnings("all")
+ public NoPrivateNoArgsConstructorValue(final int i) {
+ this.i = i;
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getI() {
+ return this.i;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue)) return false;
+ final NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue other = (NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue) o;
+ if (this.getI() != other.getI()) return false;
+ return true;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.getI();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue(i=" + this.getI() + ")";
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/PrivateNoArgsConstructor.java b/test/transform/resource/after-delombok/PrivateNoArgsConstructor.java
new file mode 100644
index 00000000..18e6f211
--- /dev/null
+++ b/test/transform/resource/after-delombok/PrivateNoArgsConstructor.java
@@ -0,0 +1,236 @@
+public class PrivateNoArgsConstructor {
+ private static class Base {
+ }
+ public static class PrivateNoArgsConstructorNotOnExtends extends Base {
+ private final int a;
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorNotOnExtends(final int a) {
+ this.a = a;
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getA() {
+ return this.a;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (!super.equals(o)) return false;
+ if (this.getA() != other.getA()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = super.hashCode();
+ result = result * PRIME + this.getA();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends(a=" + this.getA() + ")";
+ }
+ }
+ public static class PrivateNoArgsConstructorOnExtendsObject extends Object {
+ private final int b;
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorOnExtendsObject(final int b) {
+ this.b = b;
+ }
+ @java.lang.SuppressWarnings("all")
+ private PrivateNoArgsConstructorOnExtendsObject() {
+ this.b = 0;
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getB() {
+ return this.b;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (this.getB() != other.getB()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.getB();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject(b=" + this.getB() + ")";
+ }
+ }
+ public static class PrivateNoArgsConstructorExplicitBefore {
+ private final int c;
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorExplicitBefore() {
+ this.c = 0;
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getC() {
+ return this.c;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (this.getC() != other.getC()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.getC();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore(c=" + this.getC() + ")";
+ }
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorExplicitBefore(final int c) {
+ this.c = c;
+ }
+ }
+ public static class PrivateNoArgsConstructorExplicitAfter {
+ private final int d;
+ @java.lang.SuppressWarnings("all")
+ public int getD() {
+ return this.d;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (this.getD() != other.getD()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.getD();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter(d=" + this.getD() + ")";
+ }
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorExplicitAfter() {
+ this.d = 0;
+ }
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorExplicitAfter(final int d) {
+ this.d = d;
+ }
+ }
+ public static class PrivateNoArgsConstructorExplicitNone {
+ private final int e;
+ @java.lang.SuppressWarnings("all")
+ public int getE() {
+ return this.e;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (this.getE() != other.getE()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.getE();
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone(e=" + this.getE() + ")";
+ }
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorExplicitNone(final int e) {
+ this.e = e;
+ }
+ }
+ public static class PrivateNoArgsConstructorNoFields {
+ @java.lang.SuppressWarnings("all")
+ public PrivateNoArgsConstructorNoFields() {
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields)) return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ int result = 1;
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields()";
+ }
+ }
+}
diff --git a/test/transform/resource/after-ecj/DataConfiguration.java b/test/transform/resource/after-ecj/DataConfiguration.java
index 1e7adfbf..25f7620e 100644
--- a/test/transform/resource/after-ecj/DataConfiguration.java
+++ b/test/transform/resource/after-ecj/DataConfiguration.java
@@ -31,4 +31,8 @@
super();
this.x = x;
}
+ private @java.lang.SuppressWarnings("all") DataConfiguration() {
+ super();
+ this.x = 0;
+ }
}
diff --git a/test/transform/resource/after-ecj/FieldNameConstantsBasic.java b/test/transform/resource/after-ecj/FieldNameConstantsBasic.java
index bfa339fb..f77203ba 100644
--- a/test/transform/resource/after-ecj/FieldNameConstantsBasic.java
+++ b/test/transform/resource/after-ecj/FieldNameConstantsBasic.java
@@ -1,8 +1,8 @@
import lombok.experimental.FieldNameConstants;
import lombok.AccessLevel;
public @FieldNameConstants class FieldNameConstantsBasic {
- public static final java.lang.String BUT_PRINT_ME_PLEASE = "butPrintMePlease";
- protected static final java.lang.String I_AM_A_DVD_PLAYER = "iAmADvdPlayer";
+ public static final java.lang.String FIELD_BUT_PRINT_ME_PLEASE = "butPrintMePlease";
+ protected static final java.lang.String FIELD_I_AM_A_DVD_PLAYER = "iAmADvdPlayer";
@FieldNameConstants(level = AccessLevel.PROTECTED) String iAmADvdPlayer;
int $skipMe;
static double skipMeToo;
diff --git a/test/transform/resource/after-ecj/FieldNameConstantsConfigKeys.java b/test/transform/resource/after-ecj/FieldNameConstantsConfigKeys.java
new file mode 100644
index 00000000..44629ee5
--- /dev/null
+++ b/test/transform/resource/after-ecj/FieldNameConstantsConfigKeys.java
@@ -0,0 +1,9 @@
+public @lombok.experimental.FieldNameConstants class FieldNameConstantsConfigKeys {
+ public static final java.lang.String I_AM_A_DVD_PLAYER_SFX = "iAmADvdPlayer";
+ String iAmADvdPlayer;
+ <clinit>() {
+ }
+ public FieldNameConstantsConfigKeys() {
+ super();
+ }
+}
diff --git a/test/transform/resource/after-ecj/FieldNameConstantsWeird.java b/test/transform/resource/after-ecj/FieldNameConstantsWeird.java
index c581b7ef..9958f664 100644
--- a/test/transform/resource/after-ecj/FieldNameConstantsWeird.java
+++ b/test/transform/resource/after-ecj/FieldNameConstantsWeird.java
@@ -1,8 +1,12 @@
import lombok.experimental.FieldNameConstants;
import lombok.AccessLevel;
public @FieldNameConstants class FieldNameConstantsWeird {
+ public static final java.lang.String FIELD_AZ = "A";
@FieldNameConstants(level = AccessLevel.NONE) String iAmADvdPlayer;
- String X;
+ @FieldNameConstants(prefix = "") String X;
+ @FieldNameConstants(suffix = "Z") String A;
+ <clinit>() {
+ }
public FieldNameConstantsWeird() {
super();
}
diff --git a/test/transform/resource/after-ecj/LoggerFlogger.java b/test/transform/resource/after-ecj/LoggerFlogger.java
new file mode 100644
index 00000000..d0526eee
--- /dev/null
+++ b/test/transform/resource/after-ecj/LoggerFlogger.java
@@ -0,0 +1,30 @@
+import lombok.extern.flogger.Flogger;
+@lombok.extern.flogger.Flogger class LoggerFlogger {
+ private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
+ <clinit>() {
+ }
+ LoggerFlogger() {
+ super();
+ }
+}
+@Flogger class LoggerFloggerWithImport {
+ private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
+ <clinit>() {
+ }
+ LoggerFloggerWithImport() {
+ super();
+ }
+}
+class LoggerFloggerOuter {
+ static @lombok.extern.flogger.Flogger class Inner {
+ private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass();
+ <clinit>() {
+ }
+ Inner() {
+ super();
+ }
+ }
+ LoggerFloggerOuter() {
+ super();
+ }
+}
diff --git a/test/transform/resource/after-ecj/NoPrivateNoArgsConstructor.java b/test/transform/resource/after-ecj/NoPrivateNoArgsConstructor.java
new file mode 100644
index 00000000..a2bfe3bd
--- /dev/null
+++ b/test/transform/resource/after-ecj/NoPrivateNoArgsConstructor.java
@@ -0,0 +1,68 @@
+public class NoPrivateNoArgsConstructor {
+ public static @lombok.Data class NoPrivateNoArgsConstructorData {
+ private final int i;
+ public @java.lang.SuppressWarnings("all") int getI() {
+ return this.i;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData)))
+ return false;
+ final NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData other = (NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getI() != other.getI()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getI());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorData(i=" + this.getI()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") NoPrivateNoArgsConstructorData(final int i) {
+ super();
+ this.i = i;
+ }
+ }
+ public static final @lombok.Value class NoPrivateNoArgsConstructorValue {
+ private final int i;
+ public @java.lang.SuppressWarnings("all") int getI() {
+ return this.i;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue)))
+ return false;
+ final NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue other = (NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue) o;
+ if ((this.getI() != other.getI()))
+ return false;
+ return true;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getI());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("NoPrivateNoArgsConstructor.NoPrivateNoArgsConstructorValue(i=" + this.getI()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") NoPrivateNoArgsConstructorValue(final int i) {
+ super();
+ this.i = i;
+ }
+ }
+ public NoPrivateNoArgsConstructor() {
+ super();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/PrivateNoArgsConstructor.java b/test/transform/resource/after-ecj/PrivateNoArgsConstructor.java
new file mode 100644
index 00000000..f746ec9a
--- /dev/null
+++ b/test/transform/resource/after-ecj/PrivateNoArgsConstructor.java
@@ -0,0 +1,219 @@
+public class PrivateNoArgsConstructor {
+ private static class Base {
+ private Base() {
+ super();
+ }
+ }
+ public static @lombok.Data class PrivateNoArgsConstructorNotOnExtends extends Base {
+ private final int a;
+ public @java.lang.SuppressWarnings("all") int getA() {
+ return this.a;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((! super.equals(o)))
+ return false;
+ if ((this.getA() != other.getA()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = super.hashCode();
+ result = ((result * PRIME) + this.getA());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("PrivateNoArgsConstructor.PrivateNoArgsConstructorNotOnExtends(a=" + this.getA()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorNotOnExtends(final int a) {
+ super();
+ this.a = a;
+ }
+ }
+ public static @lombok.Data class PrivateNoArgsConstructorOnExtendsObject extends Object {
+ private final int b;
+ public @java.lang.SuppressWarnings("all") int getB() {
+ return this.b;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getB() != other.getB()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getB());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("PrivateNoArgsConstructor.PrivateNoArgsConstructorOnExtendsObject(b=" + this.getB()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorOnExtendsObject(final int b) {
+ super();
+ this.b = b;
+ }
+ private @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorOnExtendsObject() {
+ super();
+ this.b = 0;
+ }
+ }
+ public static @lombok.NoArgsConstructor(force = true) @lombok.Data @lombok.RequiredArgsConstructor class PrivateNoArgsConstructorExplicitBefore {
+ private final int c;
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorExplicitBefore() {
+ super();
+ this.c = 0;
+ }
+ public @java.lang.SuppressWarnings("all") int getC() {
+ return this.c;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getC() != other.getC()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getC());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitBefore(c=" + this.getC()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorExplicitBefore(final int c) {
+ super();
+ this.c = c;
+ }
+ }
+ public static @lombok.Data @lombok.NoArgsConstructor(force = true) @lombok.RequiredArgsConstructor class PrivateNoArgsConstructorExplicitAfter {
+ private final int d;
+ public @java.lang.SuppressWarnings("all") int getD() {
+ return this.d;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getD() != other.getD()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getD());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitAfter(d=" + this.getD()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorExplicitAfter() {
+ super();
+ this.d = 0;
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorExplicitAfter(final int d) {
+ super();
+ this.d = d;
+ }
+ }
+ public static @lombok.Data @lombok.NoArgsConstructor(access = lombok.AccessLevel.NONE) @lombok.RequiredArgsConstructor class PrivateNoArgsConstructorExplicitNone {
+ private final int e;
+ public @java.lang.SuppressWarnings("all") int getE() {
+ return this.e;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.getE() != other.getE()))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.getE());
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("PrivateNoArgsConstructor.PrivateNoArgsConstructorExplicitNone(e=" + this.getE()) + ")");
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorExplicitNone(final int e) {
+ super();
+ this.e = e;
+ }
+ }
+ public static @lombok.Data class PrivateNoArgsConstructorNoFields {
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields)))
+ return false;
+ final PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields other = (PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ int result = 1;
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return "PrivateNoArgsConstructor.PrivateNoArgsConstructorNoFields()";
+ }
+ public @java.lang.SuppressWarnings("all") PrivateNoArgsConstructorNoFields() {
+ super();
+ }
+ }
+ public PrivateNoArgsConstructor() {
+ super();
+ }
+}
diff --git a/test/transform/resource/before/DataConfiguration.java b/test/transform/resource/before/DataConfiguration.java
index 8b9657f9..9e0bd420 100644
--- a/test/transform/resource/before/DataConfiguration.java
+++ b/test/transform/resource/before/DataConfiguration.java
@@ -1,6 +1,7 @@
//CONF: lombok.anyConstructor.suppressConstructorProperties = true
//CONF: lombok.toString.doNotUseGetters = true
//CONF: lombok.equalsAndHashCode.doNotUseGetters = true
+//CONF: lombok.noArgsConstructor.extraPrivate = true
@lombok.Data
class DataConfiguration {
final int x;
diff --git a/test/transform/resource/before/FieldNameConstantsConfigKeys.java b/test/transform/resource/before/FieldNameConstantsConfigKeys.java
new file mode 100644
index 00000000..ab8e3091
--- /dev/null
+++ b/test/transform/resource/before/FieldNameConstantsConfigKeys.java
@@ -0,0 +1,7 @@
+//CONF: lombok.fieldNameConstants.prefix =
+//CONF: lombok.fieldNameConstants.suffix = _SFX
+
+@lombok.experimental.FieldNameConstants
+public class FieldNameConstantsConfigKeys {
+ String iAmADvdPlayer;
+}
diff --git a/test/transform/resource/before/FieldNameConstantsWeird.java b/test/transform/resource/before/FieldNameConstantsWeird.java
index 0f99133d..74ec299a 100644
--- a/test/transform/resource/before/FieldNameConstantsWeird.java
+++ b/test/transform/resource/before/FieldNameConstantsWeird.java
@@ -5,5 +5,8 @@ import lombok.AccessLevel;
public class FieldNameConstantsWeird {
@FieldNameConstants(level = AccessLevel.NONE)
String iAmADvdPlayer;
+ @FieldNameConstants(prefix = "")
String X;
+ @FieldNameConstants(suffix = "Z")
+ String A;
}
diff --git a/test/transform/resource/before/LoggerFlogger.java b/test/transform/resource/before/LoggerFlogger.java
new file mode 100644
index 00000000..b143aae9
--- /dev/null
+++ b/test/transform/resource/before/LoggerFlogger.java
@@ -0,0 +1,16 @@
+import lombok.extern.flogger.Flogger;
+
+@lombok.extern.flogger.Flogger
+class LoggerFlogger {
+}
+
+@Flogger
+class LoggerFloggerWithImport {
+}
+
+class LoggerFloggerOuter {
+ @lombok.extern.flogger.Flogger
+ static class Inner {
+
+ }
+}
diff --git a/test/transform/resource/before/NoPrivateNoArgsConstructor.java b/test/transform/resource/before/NoPrivateNoArgsConstructor.java
new file mode 100644
index 00000000..b7c2a616
--- /dev/null
+++ b/test/transform/resource/before/NoPrivateNoArgsConstructor.java
@@ -0,0 +1,12 @@
+//CONF: lombok.noArgsConstructor.extraPrivate = false
+public class NoPrivateNoArgsConstructor {
+ @lombok.Data
+ public static class NoPrivateNoArgsConstructorData {
+ private final int i;
+ }
+
+ @lombok.Value
+ public static class NoPrivateNoArgsConstructorValue {
+ int i;
+ }
+}
diff --git a/test/transform/resource/before/PrivateNoArgsConstructor.java b/test/transform/resource/before/PrivateNoArgsConstructor.java
new file mode 100644
index 00000000..38f5aed0
--- /dev/null
+++ b/test/transform/resource/before/PrivateNoArgsConstructor.java
@@ -0,0 +1,41 @@
+// CONF: lombok.noArgsConstructor.extraPrivate = true
+// CONF: lombok.equalsAndHashCode.callSuper = call
+public class PrivateNoArgsConstructor {
+ private static class Base {
+ }
+
+ @lombok.Data
+ public static class PrivateNoArgsConstructorNotOnExtends extends Base {
+ private final int a;
+ }
+
+ @lombok.Data
+ public static class PrivateNoArgsConstructorOnExtendsObject extends Object {
+ private final int b;
+ }
+
+ @lombok.NoArgsConstructor(force=true)
+ @lombok.Data
+ @lombok.RequiredArgsConstructor
+ public static class PrivateNoArgsConstructorExplicitBefore {
+ private final int c;
+ }
+
+ @lombok.Data
+ @lombok.NoArgsConstructor(force=true)
+ @lombok.RequiredArgsConstructor
+ public static class PrivateNoArgsConstructorExplicitAfter {
+ private final int d;
+ }
+
+ @lombok.Data
+ @lombok.NoArgsConstructor(access=lombok.AccessLevel.NONE)
+ @lombok.RequiredArgsConstructor
+ public static class PrivateNoArgsConstructorExplicitNone {
+ private final int e;
+ }
+
+ @lombok.Data
+ public static class PrivateNoArgsConstructorNoFields {
+ }
+}
diff --git a/test/transform/resource/messages-delombok/FieldNameConstantsWeird.java.messages b/test/transform/resource/messages-delombok/FieldNameConstantsWeird.java.messages
index d5fc44f5..02a38d58 100644
--- a/test/transform/resource/messages-delombok/FieldNameConstantsWeird.java.messages
+++ b/test/transform/resource/messages-delombok/FieldNameConstantsWeird.java.messages
@@ -1 +1 @@
-8 Not generating constant for this field: The name of the constant would be equal to the name of this field.
+9 Not generating constant for this field: The name of the constant would be equal to the name of this field.
diff --git a/test/transform/resource/messages-ecj/FieldNameConstantsWeird.java.messages b/test/transform/resource/messages-ecj/FieldNameConstantsWeird.java.messages
index d5fc44f5..02a38d58 100644
--- a/test/transform/resource/messages-ecj/FieldNameConstantsWeird.java.messages
+++ b/test/transform/resource/messages-ecj/FieldNameConstantsWeird.java.messages
@@ -1 +1 @@
-8 Not generating constant for this field: The name of the constant would be equal to the name of this field.
+9 Not generating constant for this field: The name of the constant would be equal to the name of this field.
diff --git a/website/templates/features/experimental/FieldNameConstants.html b/website/templates/features/experimental/FieldNameConstants.html
index 05c57f84..c5e57195 100644
--- a/website/templates/features/experimental/FieldNameConstants.html
+++ b/website/templates/features/experimental/FieldNameConstants.html
@@ -3,7 +3,7 @@
<@f.scaffold title="@FieldNameConstants" logline="Name... that... field! String constants for your field's names.">
<@f.history>
<p>
- @FieldNameConstants was introduced as experimental feature in lombok v2.0.0.
+ @FieldNameConstants was introduced as experimental feature in lombok v1.16.22.
</p>
</@f.history>
@@ -18,7 +18,7 @@
<@f.overview>
<p>
- The <code>@FieldNameConstants</code> annotation generates string constants (fields marked <code>public static final</code>, of type <code>java.lang.String</code>) containing the field's name, as a string. This is useful for various marshalling and serialization frameworks. The constant field has the same as the field it represents, except with all uppercase letters, with underscores in front of the uppercase letters in the original field. If this results in the exact same name, the constant is not generated (a warning is generated instead).
+ The <code>@FieldNameConstants</code> annotation generates string constants (fields marked <code>public static final</code>, of type <code>java.lang.String</code>) containing the field's name, as a string. This is useful for various marshalling and serialization frameworks. The constant field by default is named <code>FIELD_<em>NAME_OF_FIELD</em></code>, where <em>NAME_OF_FIELD</em> is the same name as the field it represents, except with all uppercase letters, with underscores in front of the uppercase letters in the original field. The prefix (and suffix) is configurable on the <code>@FieldNameConstants</code> annotation.
</p><p>
The <code>public</code> access modifier can be changed via the parameter <code>level = AccessLevel.PACKAGE</code> for example. You can force a field to be skipped by supplying <code>level = AccessLevel.NONE</code>.
</p><p>
@@ -33,12 +33,22 @@
<code>lombok.fieldNameConstants.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
</dt><dd>
Lombok will flag any usage of <code>@FieldDefaults</code> as a warning or error if configured.
+ </dd><dt>
+ <code>lombok.fieldNameConstants.prefix</code> = <em>a string</em> (default: 'PREFIX_')
+ </dt><dd>
+ Lombok will generate the name for each fieldconstant by constant-casing the field name and then prefixing this string to the result.
+ </dd><dt>
+ <code>lombok.fieldNameConstants.suffix</code> = <em>a string</em> (default: '' - the blank string)
+ </dt><dd>
+ Lombok will generate the name for each fieldconstant by constant-casing the field name and then suffixing this string to the result.
</dd>
</@f.confKeys>
<@f.smallPrint>
<p>
Like other lombok handlers that touch fields, any field whose name starts with a dollar (<code>$</code>) symbol is skipped entirely. Such a field will not be modified at all. Static fields are also skipped.
+ </p><p>
+ The annotation can itself be used to set prefix/suffix. If you do so, it overrides the <code>lombok.fieldNameConstants.prefix/suffix</code> config key. Example: <code>@FieldNameConstants(prefix = "")</code>: This would generate for field <code>helloWorld</code> a constant named <code>HELLO_WORLD</code> instead of the default <code>FIELD_HELLO_WORLD</code>.
</p>
</@f.smallPrint>
</@f.scaffold>
diff --git a/website/templates/features/log.html b/website/templates/features/log.html
index 2854e896..1de26836 100644
--- a/website/templates/features/log.html
+++ b/website/templates/features/log.html
@@ -6,6 +6,8 @@
The various <code>@Log</code> variants were added in lombok v0.10.
<em>NEW in lombok 0.10: </em>You can annotate any class with a log annotation to let lombok generate a logger field.<br/>
The logger is named <code>log</code> and the field's type depends on which logger you have selected.
+ </p><p>
+ <em>NEW in lombok v1.16.24: </em>Addition of google's FluentLogger (flogger).
</p>
</@f.history>
@@ -20,13 +22,17 @@
</dt><dd>
Creates <code><span class="keyword">private&nbsp;static&nbsp;final&nbsp;</span><a href="https://commons.apache.org/logging/apidocs/org/apache/commons/logging/Log.html">org.apache.commons.logging.Log</a>&nbsp;<span class="staticfield">log</span>&nbsp;=&nbsp;<a href="https://commons.apache.org/logging/apidocs/org/apache/commons/logging/LogFactory.html#getLog(java.lang.Class)">org.apache.commons.logging.LogFactory.getLog</a>(LogExample.<span class="keyword">class</span>);</code>
</dd><dt>
+ <code>@Flogger</code>
+ </dt><dd>
+ Creates <code><span class="keyword">private&nbsp;static&nbsp;final&nbsp;</span><a href="https://google.github.io/flogger/">com.google.common.flogger.FluentLogger</a>&nbsp;<span class="staticfield">log</span>&nbsp;=&nbsp;com.google.common.flogger.FluentLogger.forEnclosingClass();</code>
+ </dd><dt>
<code>@JBossLog</code>
</dt><dd>
- Creates <code><span class="keyword">private&nbsp;static&nbsp;final&nbsp;</span><a href="http://docs.jboss.org/jbosslogging/latest/org/jboss/logging/Logger.html">org.jboss.logging.Logger</a>&nbsp;<span class="staticfield">log</span>&nbsp;=&nbsp;<a href="http://docs.jboss.org/jbosslogging/latest/org/jboss/logging/Logger.html#getLogger(java.lang.Class)">org.jboss.logging.Logger.getLogger</a>(LogExample.<span class="keyword">class</span>);</code>
+ Creates <code><span class="keyword">private&nbsp;static&nbsp;final&nbsp;</span><a href="https://docs.jboss.org/jbosslogging/latest/org/jboss/logging/Logger.html">org.jboss.logging.Logger</a>&nbsp;<span class="staticfield">log</span>&nbsp;=&nbsp;<a href="https://docs.jboss.org/jbosslogging/latest/org/jboss/logging/Logger.html#getLogger(java.lang.Class)">org.jboss.logging.Logger.getLogger</a>(LogExample.<span class="keyword">class</span>);</code>
</dd><dt>
<code>@Log</code>
</dt><dd>
- Creates <code><span class="keyword">private&nbsp;static&nbsp;final&nbsp;</span><a href="http://download.oracle.com/javase/6/docs/api/java/util/logging/Logger.html">java.util.logging.Logger</a>&nbsp;<span class="staticfield">log</span>&nbsp;=&nbsp;<a href="http://download.oracle.com/javase/6/docs/api/java/util/logging/Logger.html#getLogger(java.lang.String)">java.util.logging.Logger.getLogger</a>(LogExample.<span class="keyword">class</span>.getName());</code>
+ Creates <code><span class="keyword">private&nbsp;static&nbsp;final&nbsp;</span><a href="https://docs.oracle.com/javase/6/docs/api/java/util/logging/Logger.html">java.util.logging.Logger</a>&nbsp;<span class="staticfield">log</span>&nbsp;=&nbsp;<a href="https://docs.oracle.com/javase/6/docs/api/java/util/logging/Logger.html#getLogger(java.lang.String)">java.util.logging.Logger.getLogger</a>(LogExample.<span class="keyword">class</span>.getName());</code>
</dd><dt>
<code>@Log4j</code>
</dt><dd>
@@ -38,11 +44,11 @@
</dd><dt>
<code>@Slf4j</code>
</dt><dd>
- Creates <code><span class="keyword">private&nbsp;static&nbsp;final&nbsp;</span><a href="http://www.slf4j.org/api/org/slf4j/Logger.html">org.slf4j.Logger</a>&nbsp;<span class="staticfield">log</span>&nbsp;=&nbsp;<a href="http://www.slf4j.org/apidocs/org/slf4j/LoggerFactory.html#getLogger(java.lang.Class)">org.slf4j.LoggerFactory.getLogger</a>(LogExample.<span class="keyword">class</span>);</code>
+ Creates <code><span class="keyword">private&nbsp;static&nbsp;final&nbsp;</span><a href="https://www.slf4j.org/api/org/slf4j/Logger.html">org.slf4j.Logger</a>&nbsp;<span class="staticfield">log</span>&nbsp;=&nbsp;<a href="https://www.slf4j.org/api/org/slf4j/LoggerFactory.html#getLogger(java.lang.Class)">org.slf4j.LoggerFactory.getLogger</a>(LogExample.<span class="keyword">class</span>);</code>
</dd><dt>
<code>@XSlf4j</code>
</dt><dd>
- Creates <code><span class="keyword">private&nbsp;static&nbsp;final&nbsp;</span><a href="http://www.slf4j.org/api/org/slf4j/ext/XLogger.html">org.slf4j.ext.XLogger</a>&nbsp;<span class="staticfield">log</span>&nbsp;=&nbsp;<a href="http://www.slf4j.org/apidocs/org/slf4j/ext/XLoggerFactory.html#getXLogger(java.lang.Class)">org.slf4j.ext.XLoggerFactory.getXLogger</a>(LogExample.<span class="keyword">class</span>);</code>
+ Creates <code><span class="keyword">private&nbsp;static&nbsp;final&nbsp;</span><a href="https://www.slf4j.org/api/org/slf4j/ext/XLogger.html">org.slf4j.ext.XLogger</a>&nbsp;<span class="staticfield">log</span>&nbsp;=&nbsp;<a href="https://www.slf4j.org/api/org/slf4j/ext/XLoggerFactory.html#getXLogger(java.lang.Class)">org.slf4j.ext.XLoggerFactory.getXLogger</a>(LogExample.<span class="keyword">class</span>);</code>
</dd>
</dl>
</p><p>
@@ -70,14 +76,18 @@
</dt><dd>
Lombok will flag any usage of <code>@lombok.extern.apachecommons.CommonsLog</code> as a warning or error if configured.
</dd><dt>
- <code>lombok.log.javaUtilLogging.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
+ <code>lombok.log.flogger.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
</dt><dd>
- Lombok will flag any usage of <code>@lombok.extern.java.Log</code> as a warning or error if configured.
+ Lombok will flag any usage of <code>@lombok.extern.flogger.Flogger</code> as a warning or error if configured.
</dd><dt>
<code>lombok.log.jbosslog.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
</dt><dd>
Lombok will flag any usage of <code>@lombok.extern.jbosslog.JBossLog</code> as a warning or error if configured.
</dd><dt>
+ <code>lombok.log.javaUtilLogging.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
+ </dt><dd>
+ Lombok will flag any usage of <code>@lombok.extern.java.Log</code> as a warning or error if configured.
+ </dd><dt>
<code>lombok.log.log4j.flagUsage</code> = [<code>warning</code> | <code>error</code>] (default: not set)
</dt><dd>
Lombok will flag any usage of <code>@lombok.extern.log4j.Log4j</code> as a warning or error if configured.