diff options
author | Roel Spilker <r.spilker@gmail.com> | 2010-11-06 20:41:36 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2010-11-06 20:41:36 +0100 |
commit | 59150328992339ec64ae015e2d1d73c109c4d322 (patch) | |
tree | ee168c6cc93bbd22730eb99bd9d5f1bf5abef602 /src/core/lombok | |
parent | 529a480ca998f7eab16ff9745e8fb08aa28072e5 (diff) | |
download | lombok-59150328992339ec64ae015e2d1d73c109c4d322.tar.gz lombok-59150328992339ec64ae015e2d1d73c109c4d322.tar.bz2 lombok-59150328992339ec64ae015e2d1d73c109c4d322.zip |
Have j.u.l. be invoked with TargetType.class.getName() instead of "TargetType"
Diffstat (limited to 'src/core/lombok')
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleLog.java | 20 | ||||
-rw-r--r-- | src/core/lombok/javac/handlers/HandleLog.java | 7 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleLog.java b/src/core/lombok/eclipse/handlers/HandleLog.java index 08f3e6f2..dfb45a29 100644 --- a/src/core/lombok/eclipse/handlers/HandleLog.java +++ b/src/core/lombok/eclipse/handlers/HandleLog.java @@ -42,7 +42,6 @@ import org.eclipse.jdt.internal.compiler.ast.MessageSend; import org.eclipse.jdt.internal.compiler.ast.NameReference; import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; -import org.eclipse.jdt.internal.compiler.ast.StringLiteral; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; @@ -216,12 +215,23 @@ public class HandleLog { // private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(TargetType.class); COMMONS(lombok.jul.Log.class, "org.apache.commons.logging.Log", "org.apache.commons.logging.LogFactory", "getLog"), - // private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger("TargetType"); + // private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(TargetType.class.getName()); JUL(lombok.jul.Log.class, "java.util.logging.Logger", "java.util.logging.Logger", "getLogger") { @Override public Expression createFactoryParameter(String typeName, Annotation source) { - Expression current = new StringLiteral(typeName.toCharArray(), source.sourceStart, source.sourceEnd, 0); - Eclipse.setGeneratedBy(current, source); - return current; + int pS = source.sourceStart, pE = source.sourceEnd; + long p = (long)pS << 32 | pE; + + MessageSend factoryParameterCall = new MessageSend(); + Eclipse.setGeneratedBy(factoryParameterCall, source); + + factoryParameterCall.receiver = super.createFactoryParameter(typeName, source); + factoryParameterCall.selector = "getName".toCharArray(); + + factoryParameterCall.nameSourcePosition = p; + factoryParameterCall.sourceStart = pS; + factoryParameterCall.sourceEnd = factoryParameterCall.statementEnd = pE; + + return factoryParameterCall; } }, diff --git a/src/core/lombok/javac/handlers/HandleLog.java b/src/core/lombok/javac/handlers/HandleLog.java index 52a308ab..014895a1 100644 --- a/src/core/lombok/javac/handlers/HandleLog.java +++ b/src/core/lombok/javac/handlers/HandleLog.java @@ -155,10 +155,13 @@ public class HandleLog { // private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(TargetType.class); COMMONS(lombok.jul.Log.class, "org.apache.commons.logging.Log", "org.apache.commons.logging.LogFactory.getLog"), - // private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger("TargetType"); + // private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(TargetType.class.getName()); JUL(lombok.jul.Log.class, "java.util.logging.Logger", "java.util.logging.Logger.getLogger") { @Override public JCExpression createFactoryParameter(JavacNode typeNode, String typeName) { - return typeNode.getTreeMaker().Literal(typeName); + TreeMaker maker = typeNode.getTreeMaker(); + JCExpression classAccess = super.createFactoryParameter(typeNode, typeName); + JCExpression method = maker.Select(classAccess, typeNode.toName("getName")); + return maker.Apply(List.<JCExpression>nil(), method, List.<JCExpression>nil()); } }, |