diff options
author | Adam Juraszek <Adam.Juraszek@ataccama.com> | 2019-05-09 08:29:52 +0200 |
---|---|---|
committer | Adam Juraszek <Adam.Juraszek@ataccama.com> | 2019-05-14 18:47:07 +0200 |
commit | 4ea4b8d27bb13ad71e3cce2312dce6d488959fd7 (patch) | |
tree | e567901b74a3db9f21858530e26c2338e06af7df /src/core/lombok/eclipse/handlers/HandleLog.java | |
parent | c479920db17e36392fa69e386156c982fe60cc27 (diff) | |
download | lombok-4ea4b8d27bb13ad71e3cce2312dce6d488959fd7.tar.gz lombok-4ea4b8d27bb13ad71e3cce2312dce6d488959fd7.tar.bz2 lombok-4ea4b8d27bb13ad71e3cce2312dce6d488959fd7.zip |
IdentifierName instead of String
Diffstat (limited to 'src/core/lombok/eclipse/handlers/HandleLog.java')
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleLog.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleLog.java b/src/core/lombok/eclipse/handlers/HandleLog.java index 8c7f7971..62ad8fab 100644 --- a/src/core/lombok/eclipse/handlers/HandleLog.java +++ b/src/core/lombok/eclipse/handlers/HandleLog.java @@ -30,6 +30,7 @@ import java.util.Arrays; import lombok.ConfigurationKeys; import lombok.core.AnnotationValues; +import lombok.core.configuration.IdentifierName; import lombok.eclipse.EclipseAnnotationHandler; import lombok.eclipse.EclipseNode; import lombok.eclipse.handlers.EclipseHandlerUtil.MemberExistsResult; @@ -48,6 +49,8 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.mangosdk.spi.ProviderFor; public class HandleLog { + private static final IdentifierName LOG = IdentifierName.valueOf("log"); + private HandleLog() { throw new UnsupportedOperationException(); } @@ -57,8 +60,8 @@ public class HandleLog { switch (owner.getKind()) { case TYPE: - String logFieldName = annotationNode.getAst().readConfiguration(ConfigurationKeys.LOG_ANY_FIELD_NAME); - if (logFieldName == null) logFieldName = "log"; + IdentifierName logFieldName = annotationNode.getAst().readConfiguration(ConfigurationKeys.LOG_ANY_FIELD_NAME); + if (logFieldName == null) logFieldName = LOG; boolean useStatic = !Boolean.FALSE.equals(annotationNode.getAst().readConfiguration(ConfigurationKeys.LOG_ANY_FIELD_IS_STATIC)); @@ -74,14 +77,14 @@ public class HandleLog { return; } - if (fieldExists(logFieldName, owner) != MemberExistsResult.NOT_EXISTS) { + if (fieldExists(logFieldName.getName(), owner) != MemberExistsResult.NOT_EXISTS) { annotationNode.addWarning("Field '" + logFieldName + "' already exists."); return; } ClassLiteralAccess loggingType = selfType(owner, source); - FieldDeclaration fieldDeclaration = createField(framework, source, loggingType, logFieldName, useStatic, loggerTopic); + FieldDeclaration fieldDeclaration = createField(framework, source, loggingType, logFieldName.getName(), useStatic, loggerTopic); fieldDeclaration.traverse(new SetGeneratedByVisitor(source), typeDecl.staticInitializerScope); // TODO temporary workaround for issue 217. http://code.google.com/p/projectlombok/issues/detail?id=217 // injectFieldSuppressWarnings(owner, fieldDeclaration); |