diff options
6 files changed, 23 insertions, 3 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleLog.java b/src/core/lombok/eclipse/handlers/HandleLog.java index ee9986b1..0f77bf76 100644 --- a/src/core/lombok/eclipse/handlers/HandleLog.java +++ b/src/core/lombok/eclipse/handlers/HandleLog.java @@ -161,7 +161,7 @@ public class HandleLog { @ProviderFor(EclipseAnnotationHandler.class) public static class HandleCommonsLog extends EclipseAnnotationHandler<lombok.extern.apachecommons.CommonsLog> { @Override public void handle(AnnotationValues<lombok.extern.apachecommons.CommonsLog> annotation, Annotation source, EclipseNode annotationNode) { - processAnnotation(LoggingFramework.COMMONS, annotation, source, annotationNode, ""); + processAnnotation(LoggingFramework.COMMONS, annotation, source, annotationNode, annotation.getInstance().value()); } } diff --git a/src/core/lombok/extern/apachecommons/CommonsLog.java b/src/core/lombok/extern/apachecommons/CommonsLog.java index 024e3744..34ac0fe6 100644 --- a/src/core/lombok/extern/apachecommons/CommonsLog.java +++ b/src/core/lombok/extern/apachecommons/CommonsLog.java @@ -59,4 +59,8 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.SOURCE) @Target(ElementType.TYPE) public @interface CommonsLog { + /** + * Sets the category of the constructed Logger. By default, it will use the type where the annotation is placed. + */ + String value() default ""; }
\ No newline at end of file diff --git a/src/core/lombok/javac/handlers/HandleLog.java b/src/core/lombok/javac/handlers/HandleLog.java index 12aa07fb..2ad16b80 100644 --- a/src/core/lombok/javac/handlers/HandleLog.java +++ b/src/core/lombok/javac/handlers/HandleLog.java @@ -111,7 +111,7 @@ public class HandleLog { @ProviderFor(JavacAnnotationHandler.class) public static class HandleCommonsLog extends JavacAnnotationHandler<lombok.extern.apachecommons.CommonsLog> { @Override public void handle(AnnotationValues<lombok.extern.apachecommons.CommonsLog> annotation, JCAnnotation ast, JavacNode annotationNode) { - processAnnotation(LoggingFramework.COMMONS, annotation, annotationNode, ""); + processAnnotation(LoggingFramework.COMMONS, annotation, annotationNode, annotation.getInstance().value()); } } diff --git a/test/transform/resource/after-delombok/LoggerCommons.java b/test/transform/resource/after-delombok/LoggerCommons.java index 6feea5b6..32ace53a 100644 --- a/test/transform/resource/after-delombok/LoggerCommons.java +++ b/test/transform/resource/after-delombok/LoggerCommons.java @@ -5,4 +5,8 @@ class LoggerCommons { class LoggerCommonsWithImport { @java.lang.SuppressWarnings("all") private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggerCommonsWithImport.class); +} +class LoggerCommonsWithDifferentName { + @java.lang.SuppressWarnings("all") + private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog("DifferentName"); }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/LoggerCommons.java b/test/transform/resource/after-ecj/LoggerCommons.java index d63bb9c1..50d07a14 100644 --- a/test/transform/resource/after-ecj/LoggerCommons.java +++ b/test/transform/resource/after-ecj/LoggerCommons.java @@ -14,4 +14,12 @@ import lombok.extern.apachecommons.CommonsLog; LoggerCommonsWithImport() { super(); } +} +@CommonsLog("DifferentName") class LoggerCommonsWithDifferentName { + private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog("DifferentName"); + <clinit>() { + } + LoggerCommonsWithDifferentName() { + super(); + } }
\ No newline at end of file diff --git a/test/transform/resource/before/LoggerCommons.java b/test/transform/resource/before/LoggerCommons.java index 52210d25..ce9e4ec4 100644 --- a/test/transform/resource/before/LoggerCommons.java +++ b/test/transform/resource/before/LoggerCommons.java @@ -6,4 +6,8 @@ class LoggerCommons { @CommonsLog class LoggerCommonsWithImport { -}
\ No newline at end of file +} + +@CommonsLog("DifferentName") +class LoggerCommonsWithDifferentName { +} |