aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/handlers/HandleVal.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-10-06 00:25:32 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-10-06 00:25:32 +0200
commit9d8c4e4099bef9b7854cc5d77bc996c3b3bf0e41 (patch)
tree6ca48925c989d3f314fbeef08931a1940b5c03cf /src/core/lombok/javac/handlers/HandleVal.java
parentb4d69f5cb8b093718bb7ffb539e5875df52ca48e (diff)
downloadlombok-9d8c4e4099bef9b7854cc5d77bc996c3b3bf0e41.tar.gz
lombok-9d8c4e4099bef9b7854cc5d77bc996c3b3bf0e41.tar.bz2
lombok-9d8c4e4099bef9b7854cc5d77bc996c3b3bf0e41.zip
New feature: FieldDefaults can now be configured to apply to _every_ file, regardless of annotations.
Diffstat (limited to 'src/core/lombok/javac/handlers/HandleVal.java')
-rw-r--r--src/core/lombok/javac/handlers/HandleVal.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/lombok/javac/handlers/HandleVal.java b/src/core/lombok/javac/handlers/HandleVal.java
index 9eadd750..337ab2d7 100644
--- a/src/core/lombok/javac/handlers/HandleVal.java
+++ b/src/core/lombok/javac/handlers/HandleVal.java
@@ -51,11 +51,11 @@ import com.sun.tools.javac.util.List;
@ResolutionResetNeeded
public class HandleVal extends JavacASTAdapter {
@Override public void visitLocal(JavacNode localNode, JCVariableDecl local) {
- if (local.vartype == null || (!local.vartype.toString().equals("val") && !local.vartype.toString().equals("lombok.val"))) return;
-
- JCTree source = local.vartype;
-
- if (!typeMatches(val.class, localNode, local.vartype)) return;
+ JCTree typeTree = local.vartype;
+ if (typeTree == null) return;
+ String typeTreeToString = typeTree.toString();
+ if (!typeTreeToString.equals("val") && !typeTreeToString.equals("lombok.val")) return;
+ if (!typeMatches(val.class, localNode, typeTree)) return;
handleFlagUsage(localNode, ConfigurationKeys.VAL_FLAG_USAGE, "val");
@@ -88,7 +88,7 @@ public class HandleVal extends JavacASTAdapter {
local.mods.flags |= Flags.FINAL;
if (!localNode.shouldDeleteLombokAnnotations()) {
- JCAnnotation valAnnotation = recursiveSetGeneratedBy(localNode.getTreeMaker().Annotation(local.vartype, List.<JCExpression>nil()), source, localNode.getContext());
+ JCAnnotation valAnnotation = recursiveSetGeneratedBy(localNode.getTreeMaker().Annotation(local.vartype, List.<JCExpression>nil()), typeTree, localNode.getContext());
local.mods.annotations = local.mods.annotations == null ? List.of(valAnnotation) : local.mods.annotations.append(valAnnotation);
}
@@ -156,7 +156,7 @@ public class HandleVal extends JavacASTAdapter {
local.vartype = JavacResolution.createJavaLangObject(localNode.getAst());
throw e;
} finally {
- recursiveSetGeneratedBy(local.vartype, source, localNode.getContext());
+ recursiveSetGeneratedBy(local.vartype, typeTree, localNode.getContext());
}
}
}