Handler and testcases for @Log4j

This commit is contained in:
Maarten Mulders committed 2014-02-08 15:38:54 +01:00
1 parent e1153c1656
commit ebc9ee5f6d
6 files changed
+22 -2

No files matched your search

@@ -181,7 +181,7 @@ public class HandleLog {
@ProviderFor(EclipseAnnotationHandler.class)
public static class HandleLog4jLog extends EclipseAnnotationHandler<lombok.extern.log4j.Log4j> {
@Override public void handle(AnnotationValues<lombok.extern.log4j.Log4j> annotation, Annotation source, EclipseNode annotationNode) {
processAnnotation(LoggingFramework.LOG4J, annotation, source, annotationNode, "");
processAnnotation(LoggingFramework.LOG4J, 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 Log4j {
/**
* Sets the category of the constructed Logger. By default, it will use the type where the annotation is placed.
*/
String value() default "";
}
@@ -131,7 +131,7 @@ public class HandleLog {
@ProviderFor(JavacAnnotationHandler.class)
public static class HandleLog4jLog extends JavacAnnotationHandler<lombok.extern.log4j.Log4j> {
@Override public void handle(AnnotationValues<lombok.extern.log4j.Log4j> annotation, JCAnnotation ast, JavacNode annotationNode) {
processAnnotation(LoggingFramework.LOG4J, annotation, annotationNode, "");
processAnnotation(LoggingFramework.LOG4J, annotation, annotationNode, annotation.getInstance().value());
}
}
@@ -5,4 +5,8 @@ class LoggerLog4j {
class LoggerLog4jWithImport {
@java.lang.SuppressWarnings("all")
private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4jWithImport.class);
}
class LoggerLog4jWithDifferentName {
@java.lang.SuppressWarnings("all")
private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger("DifferentName");
}
@@ -14,4 +14,12 @@ import lombok.extern.log4j.Log4j;
LoggerLog4jWithImport() {
super();
}
}
@Log4j("DifferentName") class LoggerLog4jWithDifferentName {
private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger("DifferentName");
<clinit>() {
}
LoggerLog4jWithDifferentName() {
super();
}
}
@@ -6,4 +6,8 @@ class LoggerLog4j {
@Log4j
class LoggerLog4jWithImport {
}
@Log4j("DifferentName")
class LoggerLog4jWithDifferentName {
}