mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-03 07:13:15 +00:00
Handler and testcases for @Log
This commit is contained in:
1 parent
f13191e02c
commit
e1153c1656
6 files changed
+22
-2
No files matched your search
@@ -171,7 +171,7 @@ public class HandleLog {
|
||||
@ProviderFor(EclipseAnnotationHandler.class)
|
||||
public static class HandleJulLog extends EclipseAnnotationHandler<lombok.extern.java.Log> {
|
||||
@Override public void handle(AnnotationValues<lombok.extern.java.Log> annotation, Annotation source, EclipseNode annotationNode) {
|
||||
processAnnotation(LoggingFramework.JUL, annotation, source, annotationNode, "");
|
||||
processAnnotation(LoggingFramework.JUL, annotation, source, annotationNode, annotation.getInstance().value());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+4
@@ -58,4 +58,8 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Log {
|
||||
/**
|
||||
* Sets the category of the constructed Logger. By default, it will use the type where the annotation is placed.
|
||||
*/
|
||||
String value() default "";
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public class HandleLog {
|
||||
@ProviderFor(JavacAnnotationHandler.class)
|
||||
public static class HandleJulLog extends JavacAnnotationHandler<lombok.extern.java.Log> {
|
||||
@Override public void handle(AnnotationValues<lombok.extern.java.Log> annotation, JCAnnotation ast, JavacNode annotationNode) {
|
||||
processAnnotation(LoggingFramework.JUL, annotation, annotationNode, "");
|
||||
processAnnotation(LoggingFramework.JUL, annotation, annotationNode, annotation.getInstance().value());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,4 +5,8 @@ class LoggerJul {
|
||||
class LoggerJulWithImport {
|
||||
@java.lang.SuppressWarnings("all")
|
||||
private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJulWithImport.class.getName());
|
||||
}
|
||||
class LoggerJulWithDifferentName {
|
||||
@java.lang.SuppressWarnings("all")
|
||||
private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger("DifferentName");
|
||||
}
|
||||
@@ -14,4 +14,12 @@ import lombok.extern.java.Log;
|
||||
LoggerJulWithImport() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@Log("DifferentName") class LoggerJulWithDifferentName {
|
||||
private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger("DifferentName");
|
||||
<clinit>() {
|
||||
}
|
||||
LoggerJulWithDifferentName() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,8 @@ class LoggerJul {
|
||||
|
||||
@Log
|
||||
class LoggerJulWithImport {
|
||||
}
|
||||
|
||||
@Log("DifferentName")
|
||||
class LoggerJulWithDifferentName {
|
||||
}
|
||||
Reference in new issue
Block a user