aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/handlers
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2011-06-20 21:03:13 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2011-06-20 21:05:06 +0200
commit0fb0c59d5aa9f18c34eac36e65dcf3c2fdf6808c (patch)
tree4c4ba80d0652b99345c88b2a6f2fecca653f9dc1 /src/core/lombok/javac/handlers
parentbdcbd1bac40ddbfeda22a99285976e2a92fd59df (diff)
downloadlombok-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/javac/handlers')
-rw-r--r--src/core/lombok/javac/handlers/HandleCleanup.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleConstructor.java18
-rw-r--r--src/core/lombok/javac/handlers/HandleData.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleDelegate.java2
-rw-r--r--src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleGetter.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleLog.java24
-rw-r--r--src/core/lombok/javac/handlers/HandlePrintAST.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleSetter.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleSneakyThrows.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleSynchronized.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleToString.java6
12 files changed, 17 insertions, 81 deletions
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;
- }
}