From 5767628efeb66644827f89861425ff173803b9ad Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sat, 18 Jan 2014 20:26:08 +0100 Subject: [configuration] Moved ALL ConfigurationKey constants into 'ConfigurationKeys'; that bug where fields in annotation defs causes issues is too endemic to try and work around these. --- src/core/lombok/eclipse/HandlerLibrary.java | 5 +++ .../lombok/eclipse/handlers/HandleAccessors.java | 43 ++++++++++++++++++++++ .../lombok/eclipse/handlers/HandleBuilder.java | 5 ++- .../lombok/eclipse/handlers/HandleCleanup.java | 5 ++- .../lombok/eclipse/handlers/HandleConstructor.java | 8 ++-- src/core/lombok/eclipse/handlers/HandleData.java | 7 ++-- .../eclipse/handlers/HandleEqualsAndHashCode.java | 9 ++--- .../eclipse/handlers/HandleExtensionMethod.java | 5 ++- .../eclipse/handlers/HandleFieldDefaults.java | 5 ++- src/core/lombok/eclipse/handlers/HandleGetter.java | 5 ++- src/core/lombok/eclipse/handlers/HandleLog.java | 16 ++++---- src/core/lombok/eclipse/handlers/HandleSetter.java | 5 ++- .../eclipse/handlers/HandleSneakyThrows.java | 5 ++- .../eclipse/handlers/HandleSynchronized.java | 5 ++- .../lombok/eclipse/handlers/HandleToString.java | 5 ++- src/core/lombok/eclipse/handlers/HandleVal.java | 5 ++- src/core/lombok/eclipse/handlers/HandleValue.java | 5 ++- src/core/lombok/eclipse/handlers/HandleWither.java | 5 ++- 18 files changed, 104 insertions(+), 44 deletions(-) create mode 100644 src/core/lombok/eclipse/handlers/HandleAccessors.java (limited to 'src/core/lombok/eclipse') diff --git a/src/core/lombok/eclipse/HandlerLibrary.java b/src/core/lombok/eclipse/HandlerLibrary.java index 242e923c..78c24ebd 100644 --- a/src/core/lombok/eclipse/HandlerLibrary.java +++ b/src/core/lombok/eclipse/HandlerLibrary.java @@ -35,6 +35,7 @@ import java.util.SortedSet; import java.util.TreeSet; import java.util.WeakHashMap; +import lombok.ConfigurationKeys; import lombok.Lombok; import lombok.core.AnnotationValues; import lombok.core.AnnotationValues.AnnotationValueDecodeFail; @@ -54,6 +55,10 @@ import org.eclipse.jdt.internal.compiler.ast.TypeReference; * building an AnnotationValues instance. */ public class HandlerLibrary { + static { + ConfigurationKeys.class.getClass(); + } + /** * Creates a new HandlerLibrary. Errors will be reported to the Eclipse Error log. * You probably want to use {@link #load()} instead. diff --git a/src/core/lombok/eclipse/handlers/HandleAccessors.java b/src/core/lombok/eclipse/handlers/HandleAccessors.java new file mode 100644 index 00000000..864ff50b --- /dev/null +++ b/src/core/lombok/eclipse/handlers/HandleAccessors.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2014 The Project Lombok Authors. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package lombok.eclipse.handlers; + +import static lombok.core.handlers.HandlerUtil.handleExperimentalFlagUsage; +import lombok.ConfigurationKeys; +import lombok.core.AnnotationValues; +import lombok.core.HandlerPriority; +import lombok.eclipse.EclipseAnnotationHandler; +import lombok.eclipse.EclipseNode; +import lombok.experimental.Accessors; + +import org.eclipse.jdt.internal.compiler.ast.Annotation; +import org.mangosdk.spi.ProviderFor; + +@ProviderFor(EclipseAnnotationHandler.class) +@HandlerPriority(65536) +public class HandleAccessors extends EclipseAnnotationHandler { + @Override public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { + // Accessors itself is handled by HandleGetter/Setter; this is just to ensure that usages are flagged if requested. + + handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.ACCESSORS_FLAG_USAGE, "@Accessors"); + } +} diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java index 7aa740a4..9cf3291f 100644 --- a/src/core/lombok/eclipse/handlers/HandleBuilder.java +++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 The Project Lombok Authors. + * Copyright (C) 2013-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -56,6 +56,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.mangosdk.spi.ProviderFor; import lombok.AccessLevel; +import lombok.ConfigurationKeys; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; import lombok.core.HandlerPriority; @@ -71,7 +72,7 @@ import lombok.experimental.NonFinal; @HandlerPriority(-1024) //-2^10; to ensure we've picked up @FieldDefault's changes (-2048) but @Value hasn't removed itself yet (-512), so that we can error on presence of it on the builder classes. public class HandleBuilder extends EclipseAnnotationHandler { @Override public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, Builder.FLAG_USAGE, "@Builder"); + handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.BUILDER_FLAG_USAGE, "@Builder"); long p = (long) ast.sourceStart << 32 | ast.sourceEnd; diff --git a/src/core/lombok/eclipse/handlers/HandleCleanup.java b/src/core/lombok/eclipse/handlers/HandleCleanup.java index 13d517d5..695ea767 100644 --- a/src/core/lombok/eclipse/handlers/HandleCleanup.java +++ b/src/core/lombok/eclipse/handlers/HandleCleanup.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2011 The Project Lombok Authors. + * Copyright (C) 2009-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -27,6 +27,7 @@ import static lombok.eclipse.handlers.EclipseHandlerUtil.*; import java.util.Arrays; import lombok.Cleanup; +import lombok.ConfigurationKeys; import lombok.core.AnnotationValues; import lombok.core.AST.Kind; import lombok.eclipse.EclipseAnnotationHandler; @@ -59,7 +60,7 @@ import org.mangosdk.spi.ProviderFor; @ProviderFor(EclipseAnnotationHandler.class) public class HandleCleanup extends EclipseAnnotationHandler { public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, Cleanup.FLAG_USAGE, "@Cleanup"); + handleFlagUsage(annotationNode, ConfigurationKeys.CLEANUP_FLAG_USAGE, "@Cleanup"); String cleanupName = annotation.getInstance().value(); if (cleanupName.length() == 0) { diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java index 782c85df..15c4d534 100644 --- a/src/core/lombok/eclipse/handlers/HandleConstructor.java +++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 The Project Lombok Authors. + * Copyright (C) 2010-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -71,7 +71,7 @@ public class HandleConstructor { @ProviderFor(EclipseAnnotationHandler.class) public static class HandleNoArgsConstructor extends EclipseAnnotationHandler { @Override public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, NoArgsConstructor.FLAG_USAGE, "@NoArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor"); + handleFlagUsage(annotationNode, ConfigurationKeys.NO_ARGS_CONSTRUCTOR_FLAG_USAGE, "@NoArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor"); EclipseNode typeNode = annotationNode.up(); if (!checkLegality(typeNode, annotationNode, NoArgsConstructor.class.getSimpleName())) return; @@ -90,7 +90,7 @@ public class HandleConstructor { @ProviderFor(EclipseAnnotationHandler.class) public static class HandleRequiredArgsConstructor extends EclipseAnnotationHandler { @Override public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, RequiredArgsConstructor.FLAG_USAGE, "@RequiredArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor"); + handleFlagUsage(annotationNode, ConfigurationKeys.REQUIRED_ARGS_CONSTRUCTOR_FLAG_USAGE, "@RequiredArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor"); EclipseNode typeNode = annotationNode.up(); if (!checkLegality(typeNode, annotationNode, RequiredArgsConstructor.class.getSimpleName())) return; @@ -138,7 +138,7 @@ public class HandleConstructor { @ProviderFor(EclipseAnnotationHandler.class) public static class HandleAllArgsConstructor extends EclipseAnnotationHandler { @Override public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, AllArgsConstructor.FLAG_USAGE, "@AllArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor"); + handleFlagUsage(annotationNode, ConfigurationKeys.ALL_ARGS_CONSTRUCTOR_FLAG_USAGE, "@AllArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor"); EclipseNode typeNode = annotationNode.up(); if (!checkLegality(typeNode, annotationNode, AllArgsConstructor.class.getSimpleName())) return; diff --git a/src/core/lombok/eclipse/handlers/HandleData.java b/src/core/lombok/eclipse/handlers/HandleData.java index ed7c0ce2..a6a8842d 100644 --- a/src/core/lombok/eclipse/handlers/HandleData.java +++ b/src/core/lombok/eclipse/handlers/HandleData.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2013 The Project Lombok Authors. + * Copyright (C) 2009-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,6 +26,7 @@ import static lombok.core.handlers.HandlerUtil.*; import java.util.Collections; import lombok.AccessLevel; +import lombok.ConfigurationKeys; import lombok.Data; import lombok.core.AnnotationValues; import lombok.eclipse.EclipseAnnotationHandler; @@ -42,8 +43,8 @@ import org.mangosdk.spi.ProviderFor; */ @ProviderFor(EclipseAnnotationHandler.class) public class HandleData extends EclipseAnnotationHandler { - public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, Data.FLAG_USAGE, "@Data"); + @Override public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { + handleFlagUsage(annotationNode, ConfigurationKeys.DATA_FLAG_USAGE, "@Data"); Data ann = annotation.getInstance(); EclipseNode typeNode = annotationNode.up(); diff --git a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java index 295646fd..3a26e9f3 100644 --- a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java +++ b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2013 The Project Lombok Authors. + * Copyright (C) 2009-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -34,6 +34,7 @@ import java.util.List; import java.util.Set; import lombok.AccessLevel; +import lombok.ConfigurationKeys; import lombok.EqualsAndHashCode; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; @@ -117,10 +118,8 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler annotation, - Annotation ast, EclipseNode annotationNode) { - - handleFlagUsage(annotationNode, EqualsAndHashCode.FLAG_USAGE, "@EqualsAndHashCode"); + @Override public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { + handleFlagUsage(annotationNode, ConfigurationKeys.EQUALS_AND_HASH_CODE_FLAG_USAGE, "@EqualsAndHashCode"); EqualsAndHashCode ann = annotation.getInstance(); List excludes = Arrays.asList(ann.exclude()); diff --git a/src/core/lombok/eclipse/handlers/HandleExtensionMethod.java b/src/core/lombok/eclipse/handlers/HandleExtensionMethod.java index 1c483aa0..8e53d873 100644 --- a/src/core/lombok/eclipse/handlers/HandleExtensionMethod.java +++ b/src/core/lombok/eclipse/handlers/HandleExtensionMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2013 The Project Lombok Authors. + * Copyright (C) 2012-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,6 +30,7 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.mangosdk.spi.ProviderFor; +import lombok.ConfigurationKeys; import lombok.core.AnnotationValues; import lombok.core.HandlerPriority; import lombok.eclipse.EclipseAnnotationHandler; @@ -41,7 +42,7 @@ import lombok.experimental.ExtensionMethod; @HandlerPriority(66560) // 2^16 + 2^10; we must run AFTER HandleVal which is at 2^16 public class HandleExtensionMethod extends EclipseAnnotationHandler { @Override public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, ExtensionMethod.FLAG_USAGE, "@ExtensionMethod"); + handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.EXTENSION_METHOD_FLAG_USAGE, "@ExtensionMethod"); TypeDeclaration typeDecl = null; EclipseNode owner = annotationNode.up(); diff --git a/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java b/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java index 89c5b72f..7d0702db 100644 --- a/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java +++ b/src/core/lombok/eclipse/handlers/HandleFieldDefaults.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 The Project Lombok Authors. + * Copyright (C) 2012-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,6 +24,7 @@ package lombok.eclipse.handlers; import static lombok.core.handlers.HandlerUtil.*; import static lombok.eclipse.handlers.EclipseHandlerUtil.*; import lombok.AccessLevel; +import lombok.ConfigurationKeys; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; import lombok.core.HandlerPriority; @@ -103,7 +104,7 @@ public class HandleFieldDefaults extends EclipseAnnotationHandler } public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, FieldDefaults.FLAG_USAGE, "@FieldDefaults"); + handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.FIELD_DEFAULTS_FLAG_USAGE, "@FieldDefaults"); EclipseNode node = annotationNode.up(); FieldDefaults instance = annotation.getInstance(); diff --git a/src/core/lombok/eclipse/handlers/HandleGetter.java b/src/core/lombok/eclipse/handlers/HandleGetter.java index 21f89fed..331cf097 100644 --- a/src/core/lombok/eclipse/handlers/HandleGetter.java +++ b/src/core/lombok/eclipse/handlers/HandleGetter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2013 The Project Lombok Authors. + * Copyright (C) 2009-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -33,6 +33,7 @@ import java.util.List; import java.util.Map; import lombok.AccessLevel; +import lombok.ConfigurationKeys; import lombok.Delegate; import lombok.Getter; import lombok.core.AST.Kind; @@ -133,7 +134,7 @@ public class HandleGetter extends EclipseAnnotationHandler { } public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, Getter.FLAG_USAGE, "@Getter"); + handleFlagUsage(annotationNode, ConfigurationKeys.GETTER_FLAG_USAGE, "@Getter"); EclipseNode node = annotationNode.up(); Getter annotationInstance = annotation.getInstance(); diff --git a/src/core/lombok/eclipse/handlers/HandleLog.java b/src/core/lombok/eclipse/handlers/HandleLog.java index 180fc094..f4cd8d07 100644 --- a/src/core/lombok/eclipse/handlers/HandleLog.java +++ b/src/core/lombok/eclipse/handlers/HandleLog.java @@ -56,10 +56,10 @@ public class HandleLog { switch (owner.getKind()) { case TYPE: - String logFieldName = annotationNode.getAst().readConfiguration(ConfigurationKeys.ANY_LOG_FIELD_NAME); + String logFieldName = annotationNode.getAst().readConfiguration(ConfigurationKeys.LOG_ANY_FIELD_NAME); if (logFieldName == null) logFieldName = "log"; - boolean useStatic = !Boolean.FALSE.equals(annotationNode.getAst().readConfiguration(ConfigurationKeys.ANY_LOG_FIELD_IS_STATIC)); + boolean useStatic = !Boolean.FALSE.equals(annotationNode.getAst().readConfiguration(ConfigurationKeys.LOG_ANY_FIELD_IS_STATIC)); TypeDeclaration typeDecl = null; if (owner.get() instanceof TypeDeclaration) typeDecl = (TypeDeclaration) owner.get(); @@ -163,7 +163,7 @@ public class HandleLog { @ProviderFor(EclipseAnnotationHandler.class) public static class HandleCommonsLog extends EclipseAnnotationHandler { @Override public void handle(AnnotationValues annotation, Annotation source, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, lombok.extern.apachecommons.CommonsLog.FLAG_USAGE, "@apachecommons.CommonsLog", ConfigurationKeys.ANY_LOG_FLAG_USAGE, "any @Log"); + handleFlagUsage(annotationNode, ConfigurationKeys.LOG_COMMONS_FLAG_USAGE, "@apachecommons.CommonsLog", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log"); processAnnotation(LoggingFramework.COMMONS, annotation, source, annotationNode); } @@ -175,7 +175,7 @@ public class HandleLog { @ProviderFor(EclipseAnnotationHandler.class) public static class HandleJulLog extends EclipseAnnotationHandler { @Override public void handle(AnnotationValues annotation, Annotation source, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, lombok.extern.java.Log.FLAG_USAGE, "@java.Log", ConfigurationKeys.ANY_LOG_FLAG_USAGE, "any @Log"); + handleFlagUsage(annotationNode, ConfigurationKeys.LOG_JUL_FLAG_USAGE, "@java.Log", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log"); processAnnotation(LoggingFramework.JUL, annotation, source, annotationNode); } @@ -187,7 +187,7 @@ public class HandleLog { @ProviderFor(EclipseAnnotationHandler.class) public static class HandleLog4jLog extends EclipseAnnotationHandler { @Override public void handle(AnnotationValues annotation, Annotation source, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, lombok.extern.log4j.Log4j.FLAG_USAGE, "@Log4j", ConfigurationKeys.ANY_LOG_FLAG_USAGE, "any @Log"); + handleFlagUsage(annotationNode, ConfigurationKeys.LOG_LOG4J_FLAG_USAGE, "@Log4j", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log"); processAnnotation(LoggingFramework.LOG4J, annotation, source, annotationNode); } @@ -199,7 +199,7 @@ public class HandleLog { @ProviderFor(EclipseAnnotationHandler.class) public static class HandleLog4j2Log extends EclipseAnnotationHandler { @Override public void handle(AnnotationValues annotation, Annotation source, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, lombok.extern.log4j.Log4j2.FLAG_USAGE, "@Log4j2", ConfigurationKeys.ANY_LOG_FLAG_USAGE, "any @Log"); + handleFlagUsage(annotationNode, ConfigurationKeys.LOG_LOG4J2_FLAG_USAGE, "@Log4j2", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log"); processAnnotation(LoggingFramework.LOG4J2, annotation, source, annotationNode); } @@ -211,7 +211,7 @@ public class HandleLog { @ProviderFor(EclipseAnnotationHandler.class) public static class HandleSlf4jLog extends EclipseAnnotationHandler { @Override public void handle(AnnotationValues annotation, Annotation source, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, lombok.extern.slf4j.Slf4j.FLAG_USAGE, "@Slf4j", ConfigurationKeys.ANY_LOG_FLAG_USAGE, "any @Log"); + handleFlagUsage(annotationNode, ConfigurationKeys.LOG_SLF4J_FLAG_USAGE, "@Slf4j", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log"); processAnnotation(LoggingFramework.SLF4J, annotation, source, annotationNode); } @@ -223,7 +223,7 @@ public class HandleLog { @ProviderFor(EclipseAnnotationHandler.class) public static class HandleXSlf4jLog extends EclipseAnnotationHandler { @Override public void handle(AnnotationValues annotation, Annotation source, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, lombok.extern.slf4j.XSlf4j.FLAG_USAGE, "@XSlf4j", ConfigurationKeys.ANY_LOG_FLAG_USAGE, "any @Log"); + handleFlagUsage(annotationNode, ConfigurationKeys.LOG_XSLF4J_FLAG_USAGE, "@XSlf4j", ConfigurationKeys.LOG_ANY_FLAG_USAGE, "any @Log"); processAnnotation(LoggingFramework.XSLF4J, annotation, source, annotationNode); } diff --git a/src/core/lombok/eclipse/handlers/HandleSetter.java b/src/core/lombok/eclipse/handlers/HandleSetter.java index 1009492a..42f0cd3f 100644 --- a/src/core/lombok/eclipse/handlers/HandleSetter.java +++ b/src/core/lombok/eclipse/handlers/HandleSetter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2013 The Project Lombok Authors. + * Copyright (C) 2009-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -32,6 +32,7 @@ import java.util.Collections; import java.util.List; import lombok.AccessLevel; +import lombok.ConfigurationKeys; import lombok.Setter; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; @@ -119,7 +120,7 @@ public class HandleSetter extends EclipseAnnotationHandler { } public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, Setter.FLAG_USAGE, "@Setter"); + handleFlagUsage(annotationNode, ConfigurationKeys.SETTER_FLAG_USAGE, "@Setter"); EclipseNode node = annotationNode.up(); AccessLevel level = annotation.getInstance().value(); diff --git a/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java b/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java index ec9acfa1..11762323 100644 --- a/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java +++ b/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2013 The Project Lombok Authors. + * Copyright (C) 2009-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import lombok.ConfigurationKeys; import lombok.SneakyThrows; import lombok.core.AnnotationValues; import lombok.core.HandlerPriority; @@ -76,7 +77,7 @@ public class HandleSneakyThrows extends EclipseAnnotationHandler { } @Override public void handle(AnnotationValues annotation, Annotation source, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, SneakyThrows.FLAG_USAGE, "@SneakyThrows"); + handleFlagUsage(annotationNode, ConfigurationKeys.SNEAKY_THROWS_FLAG_USAGE, "@SneakyThrows"); List exceptionNames = annotation.getRawExpressions("value"); List exceptions = new ArrayList(); diff --git a/src/core/lombok/eclipse/handlers/HandleSynchronized.java b/src/core/lombok/eclipse/handlers/HandleSynchronized.java index fa0b4ad0..66894153 100644 --- a/src/core/lombok/eclipse/handlers/HandleSynchronized.java +++ b/src/core/lombok/eclipse/handlers/HandleSynchronized.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2013 The Project Lombok Authors. + * Copyright (C) 2009-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,6 +26,7 @@ import static lombok.eclipse.handlers.EclipseHandlerUtil.*; import java.lang.reflect.Modifier; +import lombok.ConfigurationKeys; import lombok.Synchronized; import lombok.core.AnnotationValues; import lombok.core.HandlerPriority; @@ -106,7 +107,7 @@ public class HandleSynchronized extends EclipseAnnotationHandler { } @Override public void handle(AnnotationValues annotation, Annotation source, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, Synchronized.FLAG_USAGE, "@Synchronized"); + handleFlagUsage(annotationNode, ConfigurationKeys.SYNCHRONIZED_FLAG_USAGE, "@Synchronized"); int p1 = source.sourceStart -1; int p2 = source.sourceStart -2; diff --git a/src/core/lombok/eclipse/handlers/HandleToString.java b/src/core/lombok/eclipse/handlers/HandleToString.java index deede986..af54fd20 100644 --- a/src/core/lombok/eclipse/handlers/HandleToString.java +++ b/src/core/lombok/eclipse/handlers/HandleToString.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2013 The Project Lombok Authors. + * Copyright (C) 2009-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -33,6 +33,7 @@ import java.util.List; import java.util.Set; import lombok.AccessLevel; +import lombok.ConfigurationKeys; import lombok.ToString; import lombok.core.AnnotationValues; import lombok.core.AST.Kind; @@ -95,7 +96,7 @@ public class HandleToString extends EclipseAnnotationHandler { } public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, ToString.FLAG_USAGE, "@ToString"); + handleFlagUsage(annotationNode, ConfigurationKeys.TO_STRING_FLAG_USAGE, "@ToString"); ToString ann = annotation.getInstance(); List excludes = Arrays.asList(ann.exclude()); diff --git a/src/core/lombok/eclipse/handlers/HandleVal.java b/src/core/lombok/eclipse/handlers/HandleVal.java index fbb11d7e..a280c500 100644 --- a/src/core/lombok/eclipse/handlers/HandleVal.java +++ b/src/core/lombok/eclipse/handlers/HandleVal.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 The Project Lombok Authors. + * Copyright (C) 2010-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -22,6 +22,7 @@ package lombok.eclipse.handlers; import static lombok.core.handlers.HandlerUtil.*; +import lombok.ConfigurationKeys; import lombok.val; import lombok.core.HandlerPriority; import lombok.eclipse.DeferUntilPostDiet; @@ -44,7 +45,7 @@ import org.mangosdk.spi.ProviderFor; public class HandleVal extends EclipseASTAdapter { @Override public void visitLocal(EclipseNode localNode, LocalDeclaration local) { if (!EclipseHandlerUtil.typeMatches(val.class, localNode, local.type)) return; - handleFlagUsage(localNode, val.FLAG_USAGE, "val"); + handleFlagUsage(localNode, ConfigurationKeys.VAL_FLAG_USAGE, "val"); boolean variableOfForEach = false; diff --git a/src/core/lombok/eclipse/handlers/HandleValue.java b/src/core/lombok/eclipse/handlers/HandleValue.java index af3b1e8f..211b337a 100644 --- a/src/core/lombok/eclipse/handlers/HandleValue.java +++ b/src/core/lombok/eclipse/handlers/HandleValue.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2013 The Project Lombok Authors. + * Copyright (C) 2012-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -27,6 +27,7 @@ import static lombok.eclipse.handlers.EclipseHandlerUtil.*; import java.util.Collections; import lombok.AccessLevel; +import lombok.ConfigurationKeys; import lombok.core.AnnotationValues; import lombok.core.HandlerPriority; import lombok.eclipse.EclipseAnnotationHandler; @@ -47,7 +48,7 @@ import org.mangosdk.spi.ProviderFor; @HandlerPriority(-512) //-2^9; to ensure @EqualsAndHashCode and such pick up on this handler making the class final and messing with the fields' access levels, run earlier. public class HandleValue extends EclipseAnnotationHandler { public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, Value.FLAG_USAGE, "@Value"); + handleFlagUsage(annotationNode, ConfigurationKeys.VALUE_FLAG_USAGE, "@Value"); Value ann = annotation.getInstance(); EclipseNode typeNode = annotationNode.up(); diff --git a/src/core/lombok/eclipse/handlers/HandleWither.java b/src/core/lombok/eclipse/handlers/HandleWither.java index 76366c2c..6149bb08 100644 --- a/src/core/lombok/eclipse/handlers/HandleWither.java +++ b/src/core/lombok/eclipse/handlers/HandleWither.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2013 The Project Lombok Authors. + * Copyright (C) 2012-2014 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -32,6 +32,7 @@ import java.util.Collections; import java.util.List; import lombok.AccessLevel; +import lombok.ConfigurationKeys; import lombok.core.AST.Kind; import lombok.core.AnnotationValues; import lombok.core.TransformationsUtil; @@ -121,7 +122,7 @@ public class HandleWither extends EclipseAnnotationHandler { } @Override public void handle(AnnotationValues annotation, Annotation ast, EclipseNode annotationNode) { - handleFlagUsage(annotationNode, Wither.FLAG_USAGE, "@Wither"); + handleExperimentalFlagUsage(annotationNode, ConfigurationKeys.WITHER_FLAG_USAGE, "@Wither"); EclipseNode node = annotationNode.up(); AccessLevel level = annotation.getInstance().value(); -- cgit