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.

This commit is contained in:
Reinier Zwitserloot committed 2011-06-20 21:05:06 +02:00
1 parent bdcbd1bac4
commit 0fb0c59d5a
25 files changed
+43 -155

No files matched your search

@@ -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;
}
}
@@ -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) {
@@ -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;
@@ -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();
@@ -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();
@@ -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();
@@ -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);
}
@@ -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;
}
@@ -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();
@@ -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;
@@ -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();
@@ -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());
@@ -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;
}
}
@@ -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;
}
}
@@ -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) {
@@ -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;
}
}
@@ -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;
}
@@ -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;
}
}
@@ -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;
}
}
+4 -20
View File
@@ -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 {
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}