diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-06-20 21:03:13 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2011-06-20 21:05:06 +0200 |
commit | 0fb0c59d5aa9f18c34eac36e65dcf3c2fdf6808c (patch) | |
tree | 4c4ba80d0652b99345c88b2a6f2fecca653f9dc1 /src/core/lombok | |
parent | bdcbd1bac40ddbfeda22a99285976e2a92fd59df (diff) | |
download | lombok-0fb0c59d5aa9f18c34eac36e65dcf3c2fdf6808c.tar.gz lombok-0fb0c59d5aa9f18c34eac36e65dcf3c2fdf6808c.tar.bz2 lombok-0fb0c59d5aa9f18c34eac36e65dcf3c2fdf6808c.zip |
Javac/EclipseAnnotationHandler are now abstract classes instead of interfaces; there were too many 'option' methods (methods where you return either true or false), so we really needed the ability to pick a default.
Diffstat (limited to 'src/core/lombok')
25 files changed, 43 insertions, 155 deletions
diff --git a/src/core/lombok/eclipse/EclipseAnnotationHandler.java b/src/core/lombok/eclipse/EclipseAnnotationHandler.java index 2841eb9f..10c0b6fb 100644 --- a/src/core/lombok/eclipse/EclipseAnnotationHandler.java +++ b/src/core/lombok/eclipse/EclipseAnnotationHandler.java @@ -34,7 +34,7 @@ import lombok.core.AnnotationValues; * * You also need to register yourself via SPI discovery as being an implementation of {@code EclipseAnnotationHandler}. */ -public interface EclipseAnnotationHandler<T extends java.lang.annotation.Annotation> { +public abstract class EclipseAnnotationHandler<T extends java.lang.annotation.Annotation> { /** * Called when an annotation is found that is likely to match the annotation you're interested in. * @@ -48,12 +48,14 @@ public interface EclipseAnnotationHandler<T extends java.lang.annotation.Annotat * to travel back up the chain (something javac AST can't do) to the parent of the annotation, as well * as access useful methods such as generating warnings or errors focused on the annotation. */ - void handle(AnnotationValues<T> annotation, org.eclipse.jdt.internal.compiler.ast.Annotation ast, EclipseNode annotationNode); + public abstract void handle(AnnotationValues<T> annotation, org.eclipse.jdt.internal.compiler.ast.Annotation ast, EclipseNode annotationNode); /** * Return true if this handler should not be run in the diet parse phase. * 'diet parse' is where method bodies aren't filled in yet. If you have a method-level annotation that modifies the contents of that method, * return {@code true} here. Otherwise, return {@code false} here. */ - boolean deferUntilPostDiet(); + public boolean deferUntilPostDiet() { + return false; + } } diff --git a/src/core/lombok/eclipse/handlers/HandleCleanup.java b/src/core/lombok/eclipse/handlers/HandleCleanup.java index 6620e9d7..bbe209d5 100644 --- a/src/core/lombok/eclipse/handlers/HandleCleanup.java +++ b/src/core/lombok/eclipse/handlers/HandleCleanup.java @@ -58,11 +58,7 @@ import org.mangosdk.spi.ProviderFor; * Handles the {@code lombok.Cleanup} annotation for eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) -public class HandleCleanup implements EclipseAnnotationHandler<Cleanup> { - @Override public boolean deferUntilPostDiet() { - return false; - } - +public class HandleCleanup extends EclipseAnnotationHandler<Cleanup> { public void handle(AnnotationValues<Cleanup> annotation, Annotation ast, EclipseNode annotationNode) { 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 a0589ad7..781e8dae 100644 --- a/src/core/lombok/eclipse/handlers/HandleConstructor.java +++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java @@ -72,11 +72,7 @@ import org.mangosdk.spi.ProviderFor; public class HandleConstructor { @ProviderFor(EclipseAnnotationHandler.class) - public static class HandleNoArgsConstructor implements EclipseAnnotationHandler<NoArgsConstructor> { - @Override public boolean deferUntilPostDiet() { - return false; - } - + public static class HandleNoArgsConstructor extends EclipseAnnotationHandler<NoArgsConstructor> { @Override public void handle(AnnotationValues<NoArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) { EclipseNode typeNode = annotationNode.up(); if (!checkLegality(typeNode, annotationNode, NoArgsConstructor.class.getSimpleName())) return; @@ -91,11 +87,7 @@ public class HandleConstructor { } @ProviderFor(EclipseAnnotationHandler.class) - public static class HandleRequiredArgsConstructor implements EclipseAnnotationHandler<RequiredArgsConstructor> { - @Override public boolean deferUntilPostDiet() { - return false; - } - + public static class HandleRequiredArgsConstructor extends EclipseAnnotationHandler<RequiredArgsConstructor> { @Override public void handle(AnnotationValues<RequiredArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) { EclipseNode typeNode = annotationNode.up(); if (!checkLegality(typeNode, annotationNode, RequiredArgsConstructor.class.getSimpleName())) return; @@ -124,11 +116,7 @@ public class HandleConstructor { } @ProviderFor(EclipseAnnotationHandler.class) - public static class HandleAllArgsConstructor implements EclipseAnnotationHandler<AllArgsConstructor> { - @Override public boolean deferUntilPostDiet() { - return false; - } - + public static class HandleAllArgsConstructor extends EclipseAnnotationHandler<AllArgsConstructor> { @Override public void handle(AnnotationValues<AllArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) { 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 5d05af6b..71027c07 100644 --- a/src/core/lombok/eclipse/handlers/HandleData.java +++ b/src/core/lombok/eclipse/handlers/HandleData.java @@ -36,11 +36,7 @@ import org.mangosdk.spi.ProviderFor; * Handles the {@code lombok.Data} annotation for eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) -public class HandleData implements EclipseAnnotationHandler<Data> { - @Override public boolean deferUntilPostDiet() { - return false; - } - +public class HandleData extends EclipseAnnotationHandler<Data> { public void handle(AnnotationValues<Data> annotation, Annotation ast, EclipseNode annotationNode) { 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 9fdbea1e..05fbd0e2 100644 --- a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java +++ b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java @@ -86,7 +86,7 @@ import lombok.eclipse.EclipseNode; * Handles the {@code EqualsAndHashCode} annotation for eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) -public class HandleEqualsAndHashCode implements EclipseAnnotationHandler<EqualsAndHashCode> { +public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndHashCode> { private static final Set<String> BUILT_IN_TYPES = Collections.unmodifiableSet(new HashSet<String>(Arrays.asList( "byte", "short", "int", "long", "char", "boolean", "double", "float"))); @@ -116,10 +116,6 @@ public class HandleEqualsAndHashCode implements EclipseAnnotationHandler<EqualsA generateMethods(typeNode, errorNode, null, null, null, false, FieldAccess.GETTER); } - @Override public boolean deferUntilPostDiet() { - return false; - } - @Override public void handle(AnnotationValues<EqualsAndHashCode> annotation, Annotation ast, EclipseNode annotationNode) { EqualsAndHashCode ann = annotation.getInstance(); diff --git a/src/core/lombok/eclipse/handlers/HandleGetter.java b/src/core/lombok/eclipse/handlers/HandleGetter.java index 17f2880c..88b24f8c 100644 --- a/src/core/lombok/eclipse/handlers/HandleGetter.java +++ b/src/core/lombok/eclipse/handlers/HandleGetter.java @@ -70,7 +70,7 @@ import org.mangosdk.spi.ProviderFor; * Handles the {@code lombok.Getter} annotation for eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) -public class HandleGetter implements EclipseAnnotationHandler<Getter> { +public class HandleGetter extends EclipseAnnotationHandler<Getter> { public boolean generateGetterForType(EclipseNode typeNode, EclipseNode pos, AccessLevel level, boolean checkForTypeLevelGetter) { if (checkForTypeLevelGetter) { if (typeNode != null) for (EclipseNode child : typeNode.down()) { @@ -131,10 +131,6 @@ public class HandleGetter implements EclipseAnnotationHandler<Getter> { createGetterForField(level, fieldNode, fieldNode, pos, false, onMethod, lazy); } - @Override public boolean deferUntilPostDiet() { - return false; - } - public void handle(AnnotationValues<Getter> annotation, Annotation ast, EclipseNode annotationNode) { 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 9a10e5bc..f6d0745b 100644 --- a/src/core/lombok/eclipse/handlers/HandleLog.java +++ b/src/core/lombok/eclipse/handlers/HandleLog.java @@ -152,11 +152,7 @@ public class HandleLog { * Handles the {@link lombok.extern.apachecommons.CommonsLog} annotation for Eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) - public static class HandleCommonsLog implements EclipseAnnotationHandler<lombok.extern.apachecommons.CommonsLog> { - @Override public boolean deferUntilPostDiet() { - return false; - } - + public static class HandleCommonsLog extends EclipseAnnotationHandler<lombok.extern.apachecommons.CommonsLog> { @Override public void handle(AnnotationValues<lombok.extern.apachecommons.CommonsLog> annotation, Annotation source, EclipseNode annotationNode) { processAnnotation(LoggingFramework.COMMONS, annotation, source, annotationNode); } @@ -166,11 +162,7 @@ public class HandleLog { * Handles the {@link lombok.extern.java.Log} annotation for Eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) - public static class HandleJulLog implements EclipseAnnotationHandler<lombok.extern.java.Log> { - @Override public boolean deferUntilPostDiet() { - return false; - } - + 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); } @@ -180,11 +172,7 @@ public class HandleLog { * Handles the {@link lombok.extern.log4j.Log4j} annotation for Eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) - public static class HandleLog4jLog implements EclipseAnnotationHandler<lombok.extern.log4j.Log4j> { - @Override public boolean deferUntilPostDiet() { - return false; - } - + public static class HandleLog4jLog extends EclipseAnnotationHandler<lombok.extern.log4j.Log4j> { @Override public void handle(AnnotationValues<lombok.extern.log4j.Log4j> annotation, Annotation source, EclipseNode annotationNode) { processAnnotation(LoggingFramework.LOG4J, annotation, source, annotationNode); } @@ -194,11 +182,7 @@ public class HandleLog { * Handles the {@link lombok.extern.slf4j.Slf4j} annotation for Eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) - public static class HandleSlf4jLog implements EclipseAnnotationHandler<lombok.extern.slf4j.Slf4j> { - @Override public boolean deferUntilPostDiet() { - return false; - } - + public static class HandleSlf4jLog extends EclipseAnnotationHandler<lombok.extern.slf4j.Slf4j> { @Override public void handle(AnnotationValues<lombok.extern.slf4j.Slf4j> annotation, Annotation source, EclipseNode annotationNode) { processAnnotation(LoggingFramework.SLF4J, annotation, source, annotationNode); } diff --git a/src/core/lombok/eclipse/handlers/HandlePrintAST.java b/src/core/lombok/eclipse/handlers/HandlePrintAST.java index 6fa7b938..95db4e18 100644 --- a/src/core/lombok/eclipse/handlers/HandlePrintAST.java +++ b/src/core/lombok/eclipse/handlers/HandlePrintAST.java @@ -39,7 +39,7 @@ import lombok.eclipse.EclipseNode; * Handles the {@code lombok.core.PrintAST} annotation for eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) -public class HandlePrintAST implements EclipseAnnotationHandler<PrintAST> { +public class HandlePrintAST extends EclipseAnnotationHandler<PrintAST> { @Override public boolean deferUntilPostDiet() { return true; } diff --git a/src/core/lombok/eclipse/handlers/HandleSetter.java b/src/core/lombok/eclipse/handlers/HandleSetter.java index c9f98d15..1f1ab628 100644 --- a/src/core/lombok/eclipse/handlers/HandleSetter.java +++ b/src/core/lombok/eclipse/handlers/HandleSetter.java @@ -57,7 +57,7 @@ import org.mangosdk.spi.ProviderFor; * Handles the {@code lombok.Setter} annotation for eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) -public class HandleSetter implements EclipseAnnotationHandler<Setter> { +public class HandleSetter extends EclipseAnnotationHandler<Setter> { private static final Annotation[] EMPTY_ANNOTATIONS_ARRAY = new Annotation[0]; public boolean generateSetterForType(EclipseNode typeNode, EclipseNode pos, AccessLevel level, boolean checkForTypeLevelSetter) { if (checkForTypeLevelSetter) { @@ -120,10 +120,6 @@ public class HandleSetter implements EclipseAnnotationHandler<Setter> { createSetterForField(level, fieldNode, fieldNode, pos, false, onMethod, onParam); } - @Override public boolean deferUntilPostDiet() { - return false; - } - public void handle(AnnotationValues<Setter> annotation, Annotation ast, EclipseNode annotationNode) { 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 f426b9ce..4e9070f3 100644 --- a/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java +++ b/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java @@ -54,7 +54,7 @@ import org.mangosdk.spi.ProviderFor; * Handles the {@code lombok.HandleSneakyThrows} annotation for eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) -public class HandleSneakyThrows implements EclipseAnnotationHandler<SneakyThrows> { +public class HandleSneakyThrows extends EclipseAnnotationHandler<SneakyThrows> { private static class DeclaredException { final String exceptionName; final ASTNode node; diff --git a/src/core/lombok/eclipse/handlers/HandleSynchronized.java b/src/core/lombok/eclipse/handlers/HandleSynchronized.java index 905316bc..6a971bc9 100644 --- a/src/core/lombok/eclipse/handlers/HandleSynchronized.java +++ b/src/core/lombok/eclipse/handlers/HandleSynchronized.java @@ -53,7 +53,7 @@ import org.mangosdk.spi.ProviderFor; * Handles the {@code lombok.Synchronized} annotation for eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) -public class HandleSynchronized implements EclipseAnnotationHandler<Synchronized> { +public class HandleSynchronized extends EclipseAnnotationHandler<Synchronized> { private static final char[] INSTANCE_LOCK_NAME = "$lock".toCharArray(); private static final char[] STATIC_LOCK_NAME = "$LOCK".toCharArray(); diff --git a/src/core/lombok/eclipse/handlers/HandleToString.java b/src/core/lombok/eclipse/handlers/HandleToString.java index fff8750f..f1679161 100644 --- a/src/core/lombok/eclipse/handlers/HandleToString.java +++ b/src/core/lombok/eclipse/handlers/HandleToString.java @@ -67,7 +67,7 @@ import org.mangosdk.spi.ProviderFor; * Handles the {@code ToString} annotation for eclipse. */ @ProviderFor(EclipseAnnotationHandler.class) -public class HandleToString implements EclipseAnnotationHandler<ToString> { +public class HandleToString extends EclipseAnnotationHandler<ToString> { private void checkForBogusFieldNames(EclipseNode type, AnnotationValues<ToString> annotation) { if (annotation.isExplicit("exclude")) { for (int i : createListOfNonExistentFields(Arrays.asList(annotation.getInstance().exclude()), type, true, false)) { @@ -98,10 +98,6 @@ public class HandleToString implements EclipseAnnotationHandler<ToString> { generateToString(typeNode, errorNode, null, null, includeFieldNames, null, false, FieldAccess.GETTER); } - @Override public boolean deferUntilPostDiet() { - return false; - } - public void handle(AnnotationValues<ToString> annotation, Annotation ast, EclipseNode annotationNode) { ToString ann = annotation.getInstance(); List<String> excludes = Arrays.asList(ann.exclude()); diff --git a/src/core/lombok/javac/JavacAnnotationHandler.java b/src/core/lombok/javac/JavacAnnotationHandler.java index 3e9f6660..57180d2b 100644 --- a/src/core/lombok/javac/JavacAnnotationHandler.java +++ b/src/core/lombok/javac/JavacAnnotationHandler.java @@ -38,7 +38,7 @@ import com.sun.tools.javac.tree.JCTree.JCAnnotation; * * You also need to register yourself via SPI discovery as being an implementation of {@code JavacAnnotationHandler}. */ -public interface JavacAnnotationHandler<T extends Annotation> { +public abstract class JavacAnnotationHandler<T extends Annotation> { /** * Called when an annotation is found that is likely to match the annotation you're interested in. * @@ -52,10 +52,12 @@ public interface JavacAnnotationHandler<T extends Annotation> { * to travel back up the chain (something javac AST can't do) to the parent of the annotation, as well * as access useful methods such as generating warnings or errors focused on the annotation. */ - void handle(AnnotationValues<T> annotation, JCAnnotation ast, JavacNode annotationNode); + public abstract void handle(AnnotationValues<T> annotation, JCAnnotation ast, JavacNode annotationNode); /** * Return true if this handler requires resolution. */ - boolean isResolutionBased(); + public boolean isResolutionBased() { + return false; + } } diff --git a/src/core/lombok/javac/handlers/HandleCleanup.java b/src/core/lombok/javac/handlers/HandleCleanup.java index eb4b7987..cc1eb174 100644 --- a/src/core/lombok/javac/handlers/HandleCleanup.java +++ b/src/core/lombok/javac/handlers/HandleCleanup.java @@ -58,7 +58,7 @@ import com.sun.tools.javac.util.Name; * Handles the {@code lombok.Cleanup} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) -public class HandleCleanup implements JavacAnnotationHandler<Cleanup> { +public class HandleCleanup extends JavacAnnotationHandler<Cleanup> { @Override public void handle(AnnotationValues<Cleanup> annotation, JCAnnotation ast, JavacNode annotationNode) { deleteAnnotationIfNeccessary(annotationNode, Cleanup.class); String cleanupName = annotation.getInstance().value(); @@ -161,8 +161,4 @@ public class HandleCleanup implements JavacAnnotationHandler<Cleanup> { } } } - - @Override public boolean isResolutionBased() { - return false; - } } diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java index fd7d5a9d..1aab828d 100644 --- a/src/core/lombok/javac/handlers/HandleConstructor.java +++ b/src/core/lombok/javac/handlers/HandleConstructor.java @@ -58,7 +58,7 @@ import com.sun.tools.javac.util.ListBuffer; public class HandleConstructor { @ProviderFor(JavacAnnotationHandler.class) - public static class HandleNoArgsConstructor implements JavacAnnotationHandler<NoArgsConstructor> { + public static class HandleNoArgsConstructor extends JavacAnnotationHandler<NoArgsConstructor> { @Override public void handle(AnnotationValues<NoArgsConstructor> annotation, JCAnnotation ast, JavacNode annotationNode) { deleteAnnotationIfNeccessary(annotationNode, NoArgsConstructor.class); deleteImportFromCompilationUnit(annotationNode, "lombok.AccessLevel"); @@ -72,14 +72,10 @@ public class HandleConstructor { List<JCExpression> onConstructor = getAndRemoveAnnotationParameter(ast, "onConstructor"); new HandleConstructor().generateConstructor(typeNode, level, fields, staticName, onConstructor, false, false, annotationNode); } - - @Override public boolean isResolutionBased() { - return false; - } } @ProviderFor(JavacAnnotationHandler.class) - public static class HandleRequiredArgsConstructor implements JavacAnnotationHandler<RequiredArgsConstructor> { + public static class HandleRequiredArgsConstructor extends JavacAnnotationHandler<RequiredArgsConstructor> { @Override public void handle(AnnotationValues<RequiredArgsConstructor> annotation, JCAnnotation ast, JavacNode annotationNode) { deleteAnnotationIfNeccessary(annotationNode, RequiredArgsConstructor.class); deleteImportFromCompilationUnit(annotationNode, "lombok.AccessLevel"); @@ -94,10 +90,6 @@ public class HandleConstructor { List<JCExpression> onConstructor = getAndRemoveAnnotationParameter(ast, "onConstructor"); new HandleConstructor().generateConstructor(typeNode, level, findRequiredFields(typeNode), staticName, onConstructor, false, suppressConstructorProperties, annotationNode); } - - @Override public boolean isResolutionBased() { - return false; - } } private static List<JavacNode> findRequiredFields(JavacNode typeNode) { @@ -118,7 +110,7 @@ public class HandleConstructor { } @ProviderFor(JavacAnnotationHandler.class) - public static class HandleAllArgsConstructor implements JavacAnnotationHandler<AllArgsConstructor> { + public static class HandleAllArgsConstructor extends JavacAnnotationHandler<AllArgsConstructor> { @Override public void handle(AnnotationValues<AllArgsConstructor> annotation, JCAnnotation ast, JavacNode annotationNode) { deleteAnnotationIfNeccessary(annotationNode, AllArgsConstructor.class); deleteImportFromCompilationUnit(annotationNode, "lombok.AccessLevel"); @@ -146,10 +138,6 @@ public class HandleConstructor { List<JCExpression> onConstructor = getAndRemoveAnnotationParameter(ast, "onConstructor"); new HandleConstructor().generateConstructor(typeNode, level, fields.toList(), staticName, onConstructor, false, suppressConstructorProperties, annotationNode); } - - @Override public boolean isResolutionBased() { - return false; - } } static boolean checkLegality(JavacNode typeNode, JavacNode errorNode, String name) { diff --git a/src/core/lombok/javac/handlers/HandleData.java b/src/core/lombok/javac/handlers/HandleData.java index b0490b35..79fdf762 100644 --- a/src/core/lombok/javac/handlers/HandleData.java +++ b/src/core/lombok/javac/handlers/HandleData.java @@ -38,7 +38,7 @@ import com.sun.tools.javac.tree.JCTree.JCClassDecl; * Handles the {@code lombok.Data} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) -public class HandleData implements JavacAnnotationHandler<Data> { +public class HandleData extends JavacAnnotationHandler<Data> { @Override public void handle(AnnotationValues<Data> annotation, JCAnnotation ast, JavacNode annotationNode) { deleteAnnotationIfNeccessary(annotationNode, Data.class); JavacNode typeNode = annotationNode.up(); @@ -61,8 +61,4 @@ public class HandleData implements JavacAnnotationHandler<Data> { new HandleEqualsAndHashCode().generateEqualsAndHashCodeForType(typeNode, annotationNode); new HandleToString().generateToStringForType(typeNode, annotationNode); } - - @Override public boolean isResolutionBased() { - return false; - } } diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java index f1d872ae..1a33a027 100644 --- a/src/core/lombok/javac/handlers/HandleDelegate.java +++ b/src/core/lombok/javac/handlers/HandleDelegate.java @@ -74,7 +74,7 @@ import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Name; @ProviderFor(JavacAnnotationHandler.class) -public class HandleDelegate implements JavacAnnotationHandler<Delegate> { +public class HandleDelegate extends JavacAnnotationHandler<Delegate> { @Override public boolean isResolutionBased() { return true; } diff --git a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java index 1172e3ab..d77be508 100644 --- a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java +++ b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java @@ -58,7 +58,7 @@ import com.sun.tools.javac.util.Name; * Handles the {@code lombok.EqualsAndHashCode} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) -public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAndHashCode> { +public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHashCode> { private void checkForBogusFieldNames(JavacNode type, AnnotationValues<EqualsAndHashCode> annotation) { if (annotation.isExplicit("exclude")) { for (int i : createListOfNonExistentFields(List.from(annotation.getInstance().exclude()), type, true, true)) { @@ -487,8 +487,4 @@ public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAnd private JCStatement returnBool(TreeMaker maker, boolean bool) { return maker.Return(maker.Literal(Javac.getCTCint(TypeTags.class, "BOOLEAN"), bool ? 1 : 0)); } - - @Override public boolean isResolutionBased() { - return false; - } } diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java index 83b6a898..e61ad7d7 100644 --- a/src/core/lombok/javac/handlers/HandleGetter.java +++ b/src/core/lombok/javac/handlers/HandleGetter.java @@ -69,7 +69,7 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; * Handles the {@code lombok.Getter} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) -public class HandleGetter implements JavacAnnotationHandler<Getter> { +public class HandleGetter extends JavacAnnotationHandler<Getter> { public void generateGetterForType(JavacNode typeNode, JavacNode errorNode, AccessLevel level, boolean checkForTypeLevelGetter) { if (checkForTypeLevelGetter) { if (typeNode != null) for (JavacNode child : typeNode.down()) { @@ -369,8 +369,4 @@ public class HandleGetter implements JavacAnnotationHandler<Getter> { private JCExpression copyType(TreeMaker treeMaker, JCVariableDecl fieldNode) { return fieldNode.type != null ? treeMaker.Type(fieldNode.type) : fieldNode.vartype; } - - @Override public boolean isResolutionBased() { - return false; - } } diff --git a/src/core/lombok/javac/handlers/HandleLog.java b/src/core/lombok/javac/handlers/HandleLog.java index f4a4dead..885bd538 100644 --- a/src/core/lombok/javac/handlers/HandleLog.java +++ b/src/core/lombok/javac/handlers/HandleLog.java @@ -104,56 +104,40 @@ public class HandleLog { * Handles the {@link lombok.extern.apachecommons.CommonsLog} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) - public static class HandleCommonsLog implements JavacAnnotationHandler<lombok.extern.apachecommons.CommonsLog> { + public static class HandleCommonsLog extends JavacAnnotationHandler<lombok.extern.apachecommons.CommonsLog> { @Override public void handle(AnnotationValues<lombok.extern.apachecommons.CommonsLog> annotation, JCAnnotation ast, JavacNode annotationNode) { processAnnotation(LoggingFramework.COMMONS, annotation, annotationNode); } - - @Override public boolean isResolutionBased() { - return false; - } } /** * Handles the {@link lombok.extern.java.Log} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) - public static class HandleJulLog implements JavacAnnotationHandler<lombok.extern.java.Log> { + 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); } - - @Override public boolean isResolutionBased() { - return false; - } } /** * Handles the {@link lombok.extern.log4j.Log4j} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) - public static class HandleLog4jLog implements JavacAnnotationHandler<lombok.extern.log4j.Log4j> { + public static class HandleLog4jLog extends JavacAnnotationHandler<lombok.extern.log4j.Log4j> { @Override public void handle(AnnotationValues<lombok.extern.log4j.Log4j> annotation, JCAnnotation ast, JavacNode annotationNode) { processAnnotation(LoggingFramework.LOG4J, annotation, annotationNode); } - - @Override public boolean isResolutionBased() { - return false; - } } /** * Handles the {@link lombok.extern.slf4j.Slf4j} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) - public static class HandleSlf4jLog implements JavacAnnotationHandler<lombok.extern.slf4j.Slf4j> { + public static class HandleSlf4jLog extends JavacAnnotationHandler<lombok.extern.slf4j.Slf4j> { @Override public void handle(AnnotationValues<lombok.extern.slf4j.Slf4j> annotation, JCAnnotation ast, JavacNode annotationNode) { processAnnotation(LoggingFramework.SLF4J, annotation, annotationNode); } - - @Override public boolean isResolutionBased() { - return false; - } } enum LoggingFramework { diff --git a/src/core/lombok/javac/handlers/HandlePrintAST.java b/src/core/lombok/javac/handlers/HandlePrintAST.java index 8e7612c4..022e2487 100644 --- a/src/core/lombok/javac/handlers/HandlePrintAST.java +++ b/src/core/lombok/javac/handlers/HandlePrintAST.java @@ -40,7 +40,7 @@ import lombok.javac.JavacNode; * Handles the {@code lombok.core.PrintAST} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) -public class HandlePrintAST implements JavacAnnotationHandler<PrintAST> { +public class HandlePrintAST extends JavacAnnotationHandler<PrintAST> { @Override public void handle(AnnotationValues<PrintAST> annotation, JCAnnotation ast, JavacNode annotationNode) { PrintStream stream = System.out; String fileName = annotation.getInstance().outfile(); @@ -52,8 +52,4 @@ public class HandlePrintAST implements JavacAnnotationHandler<PrintAST> { annotationNode.up().traverse(new JavacASTVisitor.Printer(annotation.getInstance().printContent(), stream)); } - - @Override public boolean isResolutionBased() { - return false; - } } diff --git a/src/core/lombok/javac/handlers/HandleSetter.java b/src/core/lombok/javac/handlers/HandleSetter.java index 957b02ef..7763a017 100644 --- a/src/core/lombok/javac/handlers/HandleSetter.java +++ b/src/core/lombok/javac/handlers/HandleSetter.java @@ -63,7 +63,7 @@ import com.sun.tools.javac.util.Name; * Handles the {@code lombok.Setter} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) -public class HandleSetter implements JavacAnnotationHandler<Setter> { +public class HandleSetter extends JavacAnnotationHandler<Setter> { public void generateSetterForType(JavacNode typeNode, JavacNode errorNode, AccessLevel level, boolean checkForTypeLevelSetter) { if (checkForTypeLevelSetter) { if (typeNode != null) for (JavacNode child : typeNode.down()) { @@ -247,8 +247,4 @@ public class HandleSetter implements JavacAnnotationHandler<Setter> { return v.visitNoType(this, p); } } - - @Override public boolean isResolutionBased() { - return false; - } } diff --git a/src/core/lombok/javac/handlers/HandleSneakyThrows.java b/src/core/lombok/javac/handlers/HandleSneakyThrows.java index 3f1e1f0e..5b20d79e 100644 --- a/src/core/lombok/javac/handlers/HandleSneakyThrows.java +++ b/src/core/lombok/javac/handlers/HandleSneakyThrows.java @@ -51,7 +51,7 @@ import com.sun.tools.javac.util.List; * Handles the {@code lombok.SneakyThrows} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) -public class HandleSneakyThrows implements JavacAnnotationHandler<SneakyThrows> { +public class HandleSneakyThrows extends JavacAnnotationHandler<SneakyThrows> { @Override public void handle(AnnotationValues<SneakyThrows> annotation, JCAnnotation ast, JavacNode annotationNode) { deleteAnnotationIfNeccessary(annotationNode, SneakyThrows.class); Collection<String> exceptionNames = annotation.getRawExpressions("value"); @@ -111,8 +111,4 @@ public class HandleSneakyThrows implements JavacAnnotationHandler<SneakyThrows> return Javac.setGeneratedBy(maker.Try(tryBlock, List.of(Javac.recursiveSetGeneratedBy(maker.Catch(catchParam, catchBody), source)), null), source); } - - @Override public boolean isResolutionBased() { - return false; - } } diff --git a/src/core/lombok/javac/handlers/HandleSynchronized.java b/src/core/lombok/javac/handlers/HandleSynchronized.java index c8e9e79d..779adc26 100644 --- a/src/core/lombok/javac/handlers/HandleSynchronized.java +++ b/src/core/lombok/javac/handlers/HandleSynchronized.java @@ -47,7 +47,7 @@ import lombok.javac.JavacNode; * Handles the {@code lombok.Synchronized} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) -public class HandleSynchronized implements JavacAnnotationHandler<Synchronized> { +public class HandleSynchronized extends JavacAnnotationHandler<Synchronized> { private static final String INSTANCE_LOCK_NAME = "$lock"; private static final String STATIC_LOCK_NAME = "$LOCK"; @@ -107,8 +107,4 @@ public class HandleSynchronized implements JavacAnnotationHandler<Synchronized> methodNode.rebuild(); } - - @Override public boolean isResolutionBased() { - return false; - } } diff --git a/src/core/lombok/javac/handlers/HandleToString.java b/src/core/lombok/javac/handlers/HandleToString.java index 48fc90dc..5c538460 100644 --- a/src/core/lombok/javac/handlers/HandleToString.java +++ b/src/core/lombok/javac/handlers/HandleToString.java @@ -55,7 +55,7 @@ import com.sun.tools.javac.util.ListBuffer; * Handles the {@code ToString} annotation for javac. */ @ProviderFor(JavacAnnotationHandler.class) -public class HandleToString implements JavacAnnotationHandler<ToString> { +public class HandleToString extends JavacAnnotationHandler<ToString> { private void checkForBogusFieldNames(JavacNode type, AnnotationValues<ToString> annotation) { if (annotation.isExplicit("exclude")) { for (int i : createListOfNonExistentFields(List.from(annotation.getInstance().exclude()), type, true, false)) { @@ -250,8 +250,4 @@ public class HandleToString implements JavacAnnotationHandler<ToString> { } return typeName; } - - @Override public boolean isResolutionBased() { - return false; - } } |