Handlers and testcases for @CommonsLog

This commit is contained in:
Maarten Mulders committed 2014-02-08 15:18:30 +01:00
1 parent c38a64a556
commit f13191e02c
6 files changed
+23 -3

No files matched your search

@@ -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());
}
}
+4
View File
@@ -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 "";
}
@@ -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());
}
}
@@ -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");
}
@@ -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();
}
}
@@ -6,4 +6,8 @@ class LoggerCommons {
@CommonsLog
class LoggerCommonsWithImport {
}
}
@CommonsLog("DifferentName")
class LoggerCommonsWithDifferentName {
}