aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/eclipse/DeferUntilPostDiet.java37
-rw-r--r--src/core/lombok/eclipse/EclipseASTVisitor.java9
-rw-r--r--src/core/lombok/eclipse/EclipseAnnotationHandler.java11
-rw-r--r--src/core/lombok/eclipse/EclipseNode.java4
-rw-r--r--src/core/lombok/eclipse/HandlerLibrary.java4
-rw-r--r--src/core/lombok/eclipse/TransformEclipseAST.java6
-rw-r--r--src/core/lombok/eclipse/handlers/HandlePrintAST.java8
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSneakyThrows.java8
-rw-r--r--src/core/lombok/eclipse/handlers/HandleSynchronized.java8
-rw-r--r--src/core/lombok/eclipse/handlers/HandleVal.java6
-rw-r--r--src/core/lombok/javac/HandlerLibrary.java9
-rw-r--r--src/core/lombok/javac/JavacASTAdapter.java7
-rw-r--r--src/core/lombok/javac/JavacASTVisitor.java12
-rw-r--r--src/core/lombok/javac/JavacAnnotationHandler.java9
-rw-r--r--src/core/lombok/javac/ResolutionBased.java36
-rw-r--r--src/core/lombok/javac/handlers/HandleDelegate.java6
-rw-r--r--src/core/lombok/javac/handlers/HandleVal.java6
17 files changed, 103 insertions, 83 deletions
diff --git a/src/core/lombok/eclipse/DeferUntilPostDiet.java b/src/core/lombok/eclipse/DeferUntilPostDiet.java
new file mode 100644
index 00000000..e275affa
--- /dev/null
+++ b/src/core/lombok/eclipse/DeferUntilPostDiet.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Mark a handler class with this annotation to indicate that 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,
+ * you need to put this annotation on your handler. Otherwise, do not put this annotation on your handler.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface DeferUntilPostDiet {
+}
diff --git a/src/core/lombok/eclipse/EclipseASTVisitor.java b/src/core/lombok/eclipse/EclipseASTVisitor.java
index e09602e8..c51a2e87 100644
--- a/src/core/lombok/eclipse/EclipseASTVisitor.java
+++ b/src/core/lombok/eclipse/EclipseASTVisitor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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
@@ -45,13 +45,6 @@ import org.eclipse.jdt.internal.compiler.ast.TypeReference;
*/
public interface EclipseASTVisitor {
/**
- * 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();
-
- /**
* Called at the very beginning and end.
*/
void visitCompilationUnit(EclipseNode top, CompilationUnitDeclaration unit);
diff --git a/src/core/lombok/eclipse/EclipseAnnotationHandler.java b/src/core/lombok/eclipse/EclipseAnnotationHandler.java
index 55175cef..ca9cac83 100644
--- a/src/core/lombok/eclipse/EclipseAnnotationHandler.java
+++ b/src/core/lombok/eclipse/EclipseAnnotationHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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
@@ -59,13 +59,4 @@ public abstract class EclipseAnnotationHandler<T extends java.lang.annotation.An
*/
public void preHandle(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.
- */
- public boolean deferUntilPostDiet() {
- return false;
- }
}
diff --git a/src/core/lombok/eclipse/EclipseNode.java b/src/core/lombok/eclipse/EclipseNode.java
index 835020c5..2c970db2 100644
--- a/src/core/lombok/eclipse/EclipseNode.java
+++ b/src/core/lombok/eclipse/EclipseNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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
@@ -50,7 +50,7 @@ public class EclipseNode extends lombok.core.LombokNode<EclipseAST, EclipseNode,
* Visits this node and all child nodes depth-first, calling the provided visitor's visit methods.
*/
public void traverse(EclipseASTVisitor visitor) {
- if (!this.isCompleteParse() && visitor.deferUntilPostDiet()) return;
+ if (!this.isCompleteParse() && visitor.getClass().isAnnotationPresent(DeferUntilPostDiet.class)) return;
switch (getKind()) {
case COMPILATION_UNIT:
diff --git a/src/core/lombok/eclipse/HandlerLibrary.java b/src/core/lombok/eclipse/HandlerLibrary.java
index 5c75c071..d341b537 100644
--- a/src/core/lombok/eclipse/HandlerLibrary.java
+++ b/src/core/lombok/eclipse/HandlerLibrary.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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
@@ -81,7 +81,7 @@ public class HandlerLibrary {
}
public boolean deferUntilPostDiet() {
- return handler.deferUntilPostDiet();
+ return handler.getClass().isAnnotationPresent(DeferUntilPostDiet.class);
}
}
diff --git a/src/core/lombok/eclipse/TransformEclipseAST.java b/src/core/lombok/eclipse/TransformEclipseAST.java
index d67434b1..89248be1 100644
--- a/src/core/lombok/eclipse/TransformEclipseAST.java
+++ b/src/core/lombok/eclipse/TransformEclipseAST.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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
@@ -177,10 +177,6 @@ public class TransformEclipseAST {
this.skipPrintAst = skipAllButPrintAST;
}
- public boolean deferUntilPostDiet() {
- return false;
- }
-
@Override public void visitAnnotationOnField(FieldDeclaration field, EclipseNode annotationNode, Annotation annotation) {
CompilationUnitDeclaration top = (CompilationUnitDeclaration) annotationNode.top().get();
handlers.handleAnnotation(top, annotationNode, annotation, skipPrintAst);
diff --git a/src/core/lombok/eclipse/handlers/HandlePrintAST.java b/src/core/lombok/eclipse/handlers/HandlePrintAST.java
index bbb7ff47..ec7b472a 100644
--- a/src/core/lombok/eclipse/handlers/HandlePrintAST.java
+++ b/src/core/lombok/eclipse/handlers/HandlePrintAST.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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
@@ -31,6 +31,7 @@ import org.mangosdk.spi.ProviderFor;
import lombok.Lombok;
import lombok.core.AnnotationValues;
import lombok.core.PrintAST;
+import lombok.eclipse.DeferUntilPostDiet;
import lombok.eclipse.EclipseASTVisitor;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
@@ -39,11 +40,8 @@ import lombok.eclipse.EclipseNode;
* Handles the {@code lombok.core.PrintAST} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
+@DeferUntilPostDiet
public class HandlePrintAST extends EclipseAnnotationHandler<PrintAST> {
- @Override public boolean deferUntilPostDiet() {
- return true;
- }
-
public void handle(AnnotationValues<PrintAST> annotation, Annotation ast, EclipseNode annotationNode) {
PrintStream stream = System.out;
String fileName = annotation.getInstance().outfile();
diff --git a/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java b/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java
index b0e8ca01..b7c8a5d8 100644
--- a/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java
+++ b/src/core/lombok/eclipse/handlers/HandleSneakyThrows.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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 java.util.List;
import lombok.SneakyThrows;
import lombok.core.AnnotationValues;
+import lombok.eclipse.DeferUntilPostDiet;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
@@ -56,6 +57,7 @@ import org.mangosdk.spi.ProviderFor;
* Handles the {@code lombok.HandleSneakyThrows} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
+@DeferUntilPostDiet
public class HandleSneakyThrows extends EclipseAnnotationHandler<SneakyThrows> {
private static class DeclaredException {
@@ -68,10 +70,6 @@ public class HandleSneakyThrows extends EclipseAnnotationHandler<SneakyThrows> {
}
}
- @Override public boolean deferUntilPostDiet() {
- return true;
- }
-
@Override public void handle(AnnotationValues<SneakyThrows> annotation, Annotation source, EclipseNode annotationNode) {
List<String> exceptionNames = annotation.getRawExpressions("value");
List<DeclaredException> exceptions = new ArrayList<DeclaredException>();
diff --git a/src/core/lombok/eclipse/handlers/HandleSynchronized.java b/src/core/lombok/eclipse/handlers/HandleSynchronized.java
index cf9a05e0..e4c58eab 100644
--- a/src/core/lombok/eclipse/handlers/HandleSynchronized.java
+++ b/src/core/lombok/eclipse/handlers/HandleSynchronized.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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
@@ -28,6 +28,7 @@ import java.lang.reflect.Modifier;
import lombok.Synchronized;
import lombok.core.AnnotationValues;
import lombok.core.AST.Kind;
+import lombok.eclipse.DeferUntilPostDiet;
import lombok.eclipse.EclipseAnnotationHandler;
import lombok.eclipse.EclipseNode;
@@ -50,14 +51,11 @@ import org.mangosdk.spi.ProviderFor;
* Handles the {@code lombok.Synchronized} annotation for eclipse.
*/
@ProviderFor(EclipseAnnotationHandler.class)
+@DeferUntilPostDiet
public class HandleSynchronized extends EclipseAnnotationHandler<Synchronized> {
private static final char[] INSTANCE_LOCK_NAME = "$lock".toCharArray();
private static final char[] STATIC_LOCK_NAME = "$LOCK".toCharArray();
- @Override public boolean deferUntilPostDiet() {
- return true;
- }
-
@Override public void preHandle(AnnotationValues<Synchronized> annotation, Annotation source, EclipseNode annotationNode) {
EclipseNode methodNode = annotationNode.up();
if (methodNode == null || methodNode.getKind() != Kind.METHOD || !(methodNode.get() instanceof MethodDeclaration)) return;
diff --git a/src/core/lombok/eclipse/handlers/HandleVal.java b/src/core/lombok/eclipse/handlers/HandleVal.java
index a5cf29b2..56b3effd 100644
--- a/src/core/lombok/eclipse/handlers/HandleVal.java
+++ b/src/core/lombok/eclipse/handlers/HandleVal.java
@@ -22,6 +22,7 @@
package lombok.eclipse.handlers;
import lombok.val;
+import lombok.eclipse.DeferUntilPostDiet;
import lombok.eclipse.EclipseASTAdapter;
import lombok.eclipse.EclipseASTVisitor;
import lombok.eclipse.EclipseNode;
@@ -36,11 +37,8 @@ import org.mangosdk.spi.ProviderFor;
* This class just handles 3 basic error cases. The real meat of eclipse 'val' support is in {@code PatchVal} and {@code PatchValEclipse}.
*/
@ProviderFor(EclipseASTVisitor.class)
+@DeferUntilPostDiet
public class HandleVal extends EclipseASTAdapter {
- @Override public boolean deferUntilPostDiet() {
- return false;
- }
-
@Override public void visitLocal(EclipseNode localNode, LocalDeclaration local) {
if (!EclipseHandlerUtil.typeMatches(val.class, localNode, local.type)) return;
boolean variableOfForEach = false;
diff --git a/src/core/lombok/javac/HandlerLibrary.java b/src/core/lombok/javac/HandlerLibrary.java
index cba318e2..35abac6f 100644
--- a/src/core/lombok/javac/HandlerLibrary.java
+++ b/src/core/lombok/javac/HandlerLibrary.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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
@@ -74,7 +74,7 @@ public class HandlerLibrary {
}
public boolean isResolutionBased() {
- return handler.isResolutionBased();
+ return handler.getClass().isAnnotationPresent(ResolutionBased.class);
}
public void handle(final JavacNode node) {
@@ -205,8 +205,9 @@ public class HandlerLibrary {
*/
public void callASTVisitors(JavacAST ast) {
for (JavacASTVisitor visitor : visitorHandlers) try {
- if (!visitor.isResolutionBased() && phase == 0) ast.traverse(visitor);
- if (visitor.isResolutionBased() && phase == 1) ast.traverse(visitor);
+ boolean isResolutionBased = visitor.getClass().isAnnotationPresent(ResolutionBased.class);
+ if (!isResolutionBased && phase == 0) ast.traverse(visitor);
+ if (isResolutionBased && phase == 1) ast.traverse(visitor);
} catch (Throwable t) {
javacError(String.format("Lombok visitor handler %s failed", visitor.getClass()), t);
}
diff --git a/src/core/lombok/javac/JavacASTAdapter.java b/src/core/lombok/javac/JavacASTAdapter.java
index e15ed04c..5d120a77 100644
--- a/src/core/lombok/javac/JavacASTAdapter.java
+++ b/src/core/lombok/javac/JavacASTAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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
@@ -35,11 +35,6 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
*/
public class JavacASTAdapter implements JavacASTVisitor {
/** {@inheritDoc} */
- @Override public boolean isResolutionBased() {
- return false;
- }
-
- /** {@inheritDoc} */
@Override public void visitCompilationUnit(JavacNode top, JCCompilationUnit unit) {}
/** {@inheritDoc} */
diff --git a/src/core/lombok/javac/JavacASTVisitor.java b/src/core/lombok/javac/JavacASTVisitor.java
index e406340e..c57e657a 100644
--- a/src/core/lombok/javac/JavacASTVisitor.java
+++ b/src/core/lombok/javac/JavacASTVisitor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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
@@ -38,12 +38,6 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
*/
public interface JavacASTVisitor {
/**
- * If true, you'll be called after all the non-resolution based visitors.
- * NB: Temporary solution - will be rewritten to a different style altogether in a future release.
- */
- boolean isResolutionBased();
-
- /**
* Called at the very beginning and end.
*/
void visitCompilationUnit(JavacNode top, JCCompilationUnit unit);
@@ -107,10 +101,6 @@ public interface JavacASTVisitor {
private int disablePrinting = 0;
private int indent = 0;
- @Override public boolean isResolutionBased() {
- return false;
- }
-
/**
* @param printContent if true, bodies are printed directly, as java code,
* instead of a tree listing of every AST node inside it.
diff --git a/src/core/lombok/javac/JavacAnnotationHandler.java b/src/core/lombok/javac/JavacAnnotationHandler.java
index 5a2305b0..434eab46 100644
--- a/src/core/lombok/javac/JavacAnnotationHandler.java
+++ b/src/core/lombok/javac/JavacAnnotationHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2011 The Project Lombok Authors.
+ * Copyright (C) 2009-2012 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
@@ -53,11 +53,4 @@ public abstract class JavacAnnotationHandler<T extends Annotation> {
* as access useful methods such as generating warnings or errors focused on the annotation.
*/
public abstract void handle(AnnotationValues<T> annotation, JCAnnotation ast, JavacNode annotationNode);
-
- /**
- * Return true if this handler requires resolution.
- */
- public boolean isResolutionBased() {
- return false;
- }
}
diff --git a/src/core/lombok/javac/ResolutionBased.java b/src/core/lombok/javac/ResolutionBased.java
new file mode 100644
index 00000000..556e3736
--- /dev/null
+++ b/src/core/lombok/javac/ResolutionBased.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2012 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.javac;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marker to indicate a handler is to be called after all the non-resolution based visitors.
+ * NB: Temporary solution - will be rewritten to a different style altogether in a future release.
+ */
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ResolutionBased {
+}
diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java
index 18817d49..50a2f1bb 100644
--- a/src/core/lombok/javac/handlers/HandleDelegate.java
+++ b/src/core/lombok/javac/handlers/HandleDelegate.java
@@ -47,6 +47,7 @@ import lombok.javac.FindTypeVarScanner;
import lombok.javac.JavacAnnotationHandler;
import lombok.javac.JavacNode;
import lombok.javac.JavacResolution;
+import lombok.javac.ResolutionBased;
import lombok.javac.JavacResolution.TypeNotConvertibleException;
import org.mangosdk.spi.ProviderFor;
@@ -74,11 +75,8 @@ import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Name;
@ProviderFor(JavacAnnotationHandler.class)
+@ResolutionBased
public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
- @Override public boolean isResolutionBased() {
- return true;
- }
-
private static final List<String> METHODS_IN_OBJECT = Collections.unmodifiableList(Arrays.asList(
"hashCode()",
"canEqual(java.lang.Object)", //Not in j.l.Object, but it goes with hashCode and equals so if we ignore those two, we should ignore this one.
diff --git a/src/core/lombok/javac/handlers/HandleVal.java b/src/core/lombok/javac/handlers/HandleVal.java
index 4feaa3ac..52d2ed13 100644
--- a/src/core/lombok/javac/handlers/HandleVal.java
+++ b/src/core/lombok/javac/handlers/HandleVal.java
@@ -28,6 +28,7 @@ import lombok.javac.JavacASTAdapter;
import lombok.javac.JavacASTVisitor;
import lombok.javac.JavacNode;
import lombok.javac.JavacResolution;
+import lombok.javac.ResolutionBased;
import org.mangosdk.spi.ProviderFor;
@@ -43,11 +44,8 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.util.List;
@ProviderFor(JavacASTVisitor.class)
+@ResolutionBased
public class HandleVal extends JavacASTAdapter {
- @Override public boolean isResolutionBased() {
- return true;
- }
-
@Override public void visitLocal(JavacNode localNode, JCVariableDecl local) {
if (local.vartype == null || (!local.vartype.toString().equals("val") && !local.vartype.toString().equals("lombok.val"))) return;