aboutsummaryrefslogtreecommitdiff
path: root/src/lombok/javac/handlers/HandleGetter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/lombok/javac/handlers/HandleGetter.java')
-rw-r--r--src/lombok/javac/handlers/HandleGetter.java31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/lombok/javac/handlers/HandleGetter.java b/src/lombok/javac/handlers/HandleGetter.java
index 47cd3095..fd39bda2 100644
--- a/src/lombok/javac/handlers/HandleGetter.java
+++ b/src/lombok/javac/handlers/HandleGetter.java
@@ -29,7 +29,7 @@ import lombok.core.TransformationsUtil;
import lombok.core.AST.Kind;
import lombok.javac.Javac;
import lombok.javac.JavacAnnotationHandler;
-import lombok.javac.JavacAST.Node;
+import lombok.javac.JavacNode;
import org.mangosdk.spi.ProviderFor;
@@ -63,10 +63,10 @@ public class HandleGetter implements JavacAnnotationHandler<Getter> {
* If not, the getter 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 generateGetterForField(Node fieldNode, DiagnosticPosition pos) {
- for ( Node child : fieldNode.down() ) {
- if ( child.getKind() == Kind.ANNOTATION ) {
- if ( Javac.annotationTypeMatches(Getter.class, child) ) {
+ public void generateGetterForField(JavacNode fieldNode, DiagnosticPosition pos) {
+ for (JavacNode child : fieldNode.down()) {
+ if (child.getKind() == Kind.ANNOTATION) {
+ if (Javac.annotationTypeMatches(Getter.class, child)) {
//The annotation will make it happen, so we can skip it.
return;
}
@@ -76,16 +76,17 @@ public class HandleGetter implements JavacAnnotationHandler<Getter> {
createGetterForField(AccessLevel.PUBLIC, fieldNode, fieldNode, pos, false);
}
- @Override public boolean handle(AnnotationValues<Getter> annotation, JCAnnotation ast, Node annotationNode) {
- Node fieldNode = annotationNode.up();
+ @Override public boolean handle(AnnotationValues<Getter> 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 createGetterForField(level, fieldNode, annotationNode, annotationNode.get(), true);
}
- private boolean createGetterForField(AccessLevel level, Node fieldNode, Node errorNode, DiagnosticPosition pos, boolean whineIfExists) {
- if ( fieldNode.getKind() != Kind.FIELD ) {
+ private boolean createGetterForField(AccessLevel level,
+ JavacNode fieldNode, JavacNode errorNode, DiagnosticPosition pos, boolean whineIfExists) {
+ if (fieldNode.getKind() != Kind.FIELD) {
errorNode.addError("@Getter is only supported on a field.");
return true;
}
@@ -93,14 +94,14 @@ public class HandleGetter implements JavacAnnotationHandler<Getter> {
JCVariableDecl fieldDecl = (JCVariableDecl)fieldNode.get();
String methodName = toGetterName(fieldDecl);
- for ( String altName : toAllGetterNames(fieldDecl) ) {
- switch ( methodExists(altName, fieldNode) ) {
+ for (String altName : toAllGetterNames(fieldDecl)) {
+ switch (methodExists(altName, fieldNode)) {
case EXISTS_BY_LOMBOK:
return true;
case EXISTS_BY_USER:
- if ( whineIfExists ) {
+ if (whineIfExists) {
String altNameExpl = "";
- if ( !altName.equals(methodName) ) altNameExpl = String.format(" (%s)", altName);
+ if (!altName.equals(methodName)) altNameExpl = String.format(" (%s)", altName);
errorNode.addWarning(
String.format("Not generating %s(): A method with that name already exists%s", methodName, altNameExpl));
}
@@ -118,7 +119,7 @@ public class HandleGetter implements JavacAnnotationHandler<Getter> {
return true;
}
- private JCMethodDecl createGetter(long access, Node field, TreeMaker treeMaker) {
+ private JCMethodDecl createGetter(long access, JavacNode field, TreeMaker treeMaker) {
JCVariableDecl fieldNode = (JCVariableDecl) field.get();
JCStatement returnStatement = treeMaker.Return(treeMaker.Ident(fieldNode.getName()));