aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/javac/handlers/HandleSetter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/lombok/javac/handlers/HandleSetter.java')
-rw-r--r--src/lombok/javac/handlers/HandleSetter.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/lombok/javac/handlers/HandleSetter.java b/src/lombok/javac/handlers/HandleSetter.java
index 44ad0dca..f7360988 100644
--- a/src/lombok/javac/handlers/HandleSetter.java
+++ b/src/lombok/javac/handlers/HandleSetter.java
@@ -28,9 +28,8 @@ import lombok.core.AnnotationValues;
import lombok.core.TransformationsUtil;
import lombok.core.AST.Kind;
import lombok.javac.Javac;
-import lombok.javac.JavacAST;
import lombok.javac.JavacAnnotationHandler;
-import lombok.javac.JavacAST.Node;
+import lombok.javac.JavacNode;
import org.mangosdk.spi.ProviderFor;
@@ -66,10 +65,10 @@ public class HandleSetter implements JavacAnnotationHandler<Setter> {
* If not, the setter is still generated if it isn't already there, though there will not
* be a warning if its already there. The default access level is used.
*/
- public void generateSetterForField(Node fieldNode, DiagnosticPosition pos) {
- for ( Node child : fieldNode.down() ) {
- if ( child.getKind() == Kind.ANNOTATION ) {
- if ( Javac.annotationTypeMatches(Setter.class, child) ) {
+ public void generateSetterForField(JavacNode fieldNode, DiagnosticPosition pos) {
+ for (JavacNode child : fieldNode.down()) {
+ if (child.getKind() == Kind.ANNOTATION) {
+ if (Javac.annotationTypeMatches(Setter.class, child)) {
//The annotation will make it happen, so we can skip it.
return;
}
@@ -79,16 +78,17 @@ public class HandleSetter implements JavacAnnotationHandler<Setter> {
createSetterForField(AccessLevel.PUBLIC, fieldNode, fieldNode, pos, false);
}
- @Override public boolean handle(AnnotationValues<Setter> annotation, JCAnnotation ast, Node annotationNode) {
- Node fieldNode = annotationNode.up();
+ @Override public boolean handle(AnnotationValues<Setter> annotation, JCAnnotation ast, JavacNode annotationNode) {
+ JavacNode fieldNode = annotationNode.up();
AccessLevel level = annotation.getInstance().value();
- if ( level == AccessLevel.NONE ) return true;
+ if (level == AccessLevel.NONE) return true;
return createSetterForField(level, fieldNode, annotationNode, annotationNode.get(), true);
}
- private boolean createSetterForField(AccessLevel level, Node fieldNode, Node errorNode, DiagnosticPosition pos, boolean whineIfExists) {
- if ( fieldNode.getKind() != Kind.FIELD ) {
+ private boolean createSetterForField(AccessLevel level,
+ JavacNode fieldNode, JavacNode errorNode, DiagnosticPosition pos, boolean whineIfExists) {
+ if (fieldNode.getKind() != Kind.FIELD) {
fieldNode.addError("@Setter is only supported on a field.");
return true;
}
@@ -96,11 +96,11 @@ public class HandleSetter implements JavacAnnotationHandler<Setter> {
JCVariableDecl fieldDecl = (JCVariableDecl)fieldNode.get();
String methodName = toSetterName(fieldDecl);
- switch ( methodExists(methodName, fieldNode) ) {
+ switch (methodExists(methodName, fieldNode)) {
case EXISTS_BY_LOMBOK:
return true;
case EXISTS_BY_USER:
- if ( whineIfExists ) errorNode.addWarning(
+ if (whineIfExists) errorNode.addWarning(
String.format("Not generating %s(%s %s): A method with that name already exists",
methodName, fieldDecl.vartype, fieldDecl.name));
return true;
@@ -116,7 +116,7 @@ public class HandleSetter implements JavacAnnotationHandler<Setter> {
return true;
}
- private JCMethodDecl createSetter(long access, JavacAST.Node field, TreeMaker treeMaker) {
+ private JCMethodDecl createSetter(long access, JavacNode field, TreeMaker treeMaker) {
JCVariableDecl fieldDecl = (JCVariableDecl) field.get();
JCFieldAccess thisX = treeMaker.Select(treeMaker.Ident(field.toName("this")), fieldDecl.name);