Handler and testcases for @XSlf4j

This commit is contained in:
Maarten Mulders committed 2014-02-08 20:35:56 +01:00
1 parent 1045006fa9
commit c0e00edb7b
6 files changed
+22 -2

No files matched your search

@@ -211,7 +211,7 @@ public class HandleLog {
@ProviderFor(EclipseAnnotationHandler.class)
public static class HandleXSlf4jLog extends EclipseAnnotationHandler<lombok.extern.slf4j.XSlf4j> {
@Override public void handle(AnnotationValues<lombok.extern.slf4j.XSlf4j> annotation, Annotation source, EclipseNode annotationNode) {
processAnnotation(LoggingFramework.XSLF4J, annotation, source, annotationNode, "");
processAnnotation(LoggingFramework.XSLF4J, annotation, source, annotationNode, annotation.getInstance().value());
}
}
+4
View File
@@ -57,4 +57,8 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Target(ElementType.TYPE)
public @interface XSlf4j {
/**
* Sets the category of the constructed Logger. By default, it will use the type where the annotation is placed.
*/
String value() default "";
}
@@ -161,7 +161,7 @@ public class HandleLog {
@ProviderFor(JavacAnnotationHandler.class)
public static class HandleXSlf4jLog extends JavacAnnotationHandler<lombok.extern.slf4j.XSlf4j> {
@Override public void handle(AnnotationValues<lombok.extern.slf4j.XSlf4j> annotation, JCAnnotation ast, JavacNode annotationNode) {
processAnnotation(LoggingFramework.XSLF4J, annotation, annotationNode, "");
processAnnotation(LoggingFramework.XSLF4J, annotation, annotationNode, annotation.getInstance().value());
}
}
@@ -5,4 +5,8 @@ class LoggerXSlf4j {
class LoggerXSlf4jWithImport {
@java.lang.SuppressWarnings("all")
private static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger(LoggerXSlf4jWithImport.class);
}
class LoggerXSlf4jWithDifferentName {
@java.lang.SuppressWarnings("all")
private static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger("DifferentName");
}
@@ -14,4 +14,12 @@ import lombok.extern.slf4j.XSlf4j;
LoggerXSlf4jWithImport() {
super();
}
}
@XSlf4j("DifferentName") class LoggerXSlf4jWithDifferentName {
private static final org.slf4j.ext.XLogger log = org.slf4j.ext.XLoggerFactory.getXLogger("DifferentName");
<clinit>() {
}
LoggerXSlf4jWithDifferentName() {
super();
}
}
@@ -6,4 +6,8 @@ class LoggerXSlf4j {
@XSlf4j
class LoggerXSlf4jWithImport {
}
@XSlf4j("DifferentName")
class LoggerXSlf4jWithDifferentName {
}