aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/eclipse
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2020-06-25 23:01:06 +0200
committerRoel Spilker <r.spilker@gmail.com>2020-06-25 23:01:06 +0200
commite75517d561790bf8ee01763a1c75e091d03132e9 (patch)
tree6d351aa8988156311a1595bf0069c212a546c61c /src/core/lombok/eclipse
parent3ffef5d23be17e9bffca30936d43bca852feaa93 (diff)
downloadlombok-e75517d561790bf8ee01763a1c75e091d03132e9.tar.gz
lombok-e75517d561790bf8ee01763a1c75e091d03132e9.tar.bz2
lombok-e75517d561790bf8ee01763a1c75e091d03132e9.zip
Avoid class.getSimpleName except in static initializers or error messages
Diffstat (limited to 'src/core/lombok/eclipse')
-rwxr-xr-xsrc/core/lombok/eclipse/handlers/HandleConstructor.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java
index 129fa7c0..06c9ecd9 100755
--- a/src/core/lombok/eclipse/handlers/HandleConstructor.java
+++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java
@@ -84,13 +84,14 @@ import org.mangosdk.spi.ProviderFor;
public class HandleConstructor {
@ProviderFor(EclipseAnnotationHandler.class)
public static class HandleNoArgsConstructor extends EclipseAnnotationHandler<NoArgsConstructor> {
+ private static final String NAME = NoArgsConstructor.class.getSimpleName();
private HandleConstructor handleConstructor = new HandleConstructor();
@Override public void handle(AnnotationValues<NoArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) {
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;
+ if (!checkLegality(typeNode, annotationNode, NAME)) return;
NoArgsConstructor ann = annotation.getInstance();
AccessLevel level = ann.access();
String staticName = ann.staticName();
@@ -106,13 +107,14 @@ public class HandleConstructor {
@ProviderFor(EclipseAnnotationHandler.class)
public static class HandleRequiredArgsConstructor extends EclipseAnnotationHandler<RequiredArgsConstructor> {
+ private static final String NAME = RequiredArgsConstructor.class.getSimpleName();
private HandleConstructor handleConstructor = new HandleConstructor();
@Override public void handle(AnnotationValues<RequiredArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) {
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;
+ if (!checkLegality(typeNode, annotationNode, NAME)) return;
RequiredArgsConstructor ann = annotation.getInstance();
AccessLevel level = ann.access();
if (level == AccessLevel.NONE) return;
@@ -166,13 +168,15 @@ public class HandleConstructor {
@ProviderFor(EclipseAnnotationHandler.class)
public static class HandleAllArgsConstructor extends EclipseAnnotationHandler<AllArgsConstructor> {
+ private static final String NAME = AllArgsConstructor.class.getSimpleName();
+
private HandleConstructor handleConstructor = new HandleConstructor();
@Override public void handle(AnnotationValues<AllArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) {
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;
+ if (!checkLegality(typeNode, annotationNode, NAME)) return;
AllArgsConstructor ann = annotation.getInstance();
AccessLevel level = ann.access();
if (level == AccessLevel.NONE) return;