aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2013-08-06 22:59:55 +0200
committerRoel Spilker <r.spilker@gmail.com>2013-08-06 22:59:55 +0200
commit1eaaf3e276833d163f39eb06af32e678e2a7ed89 (patch)
tree7e1d78e8f42ee5aea854576c19f33759f379ad21 /src/core/lombok/javac
parent3619f889f5088ccb08245c2c3d7bc6e4459337d5 (diff)
parentdf69425550d55da3de07f922fced3872432cd9d3 (diff)
downloadlombok-1eaaf3e276833d163f39eb06af32e678e2a7ed89.tar.gz
lombok-1eaaf3e276833d163f39eb06af32e678e2a7ed89.tar.bz2
lombok-1eaaf3e276833d163f39eb06af32e678e2a7ed89.zip
Merge branch 'jdk8support' of github.com:rzwitserloot/lombok into jdk8support
Diffstat (limited to 'src/core/lombok/javac')
-rw-r--r--src/core/lombok/javac/handlers/HandleConstructor.java4
-rw-r--r--src/core/lombok/javac/handlers/HandleDelegate.java2
-rw-r--r--src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java4
-rw-r--r--src/core/lombok/javac/handlers/HandleSetter.java2
-rw-r--r--src/core/lombok/javac/handlers/HandleWither.java2
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java3
6 files changed, 10 insertions, 7 deletions
diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java
index 1134c45c..99c426de 100644
--- a/src/core/lombok/javac/handlers/HandleConstructor.java
+++ b/src/core/lombok/javac/handlers/HandleConstructor.java
@@ -231,7 +231,7 @@ public class HandleConstructor {
JCVariableDecl field = (JCVariableDecl) fieldNode.get();
List<JCAnnotation> nonNulls = findAnnotations(fieldNode, TransformationsUtil.NON_NULL_PATTERN);
List<JCAnnotation> nullables = findAnnotations(fieldNode, TransformationsUtil.NULLABLE_PATTERN);
- JCVariableDecl param = maker.VarDef(maker.Modifiers(Flags.FINAL, nonNulls.appendList(nullables)), field.name, field.vartype, null);
+ JCVariableDecl param = maker.VarDef(maker.Modifiers(Flags.FINAL | Flags.PARAMETER, nonNulls.appendList(nullables)), field.name, field.vartype, null);
params.append(param);
JCFieldAccess thisX = maker.Select(maker.Ident(fieldNode.toName("this")), field.name);
JCAssign assign = maker.Assign(thisX, maker.Ident(field.name));
@@ -292,7 +292,7 @@ public class HandleConstructor {
JCExpression pType = cloneType(maker, field.vartype, source);
List<JCAnnotation> nonNulls = findAnnotations(fieldNode, TransformationsUtil.NON_NULL_PATTERN);
List<JCAnnotation> nullables = findAnnotations(fieldNode, TransformationsUtil.NULLABLE_PATTERN);
- JCVariableDecl param = maker.VarDef(maker.Modifiers(Flags.FINAL, nonNulls.appendList(nullables)), field.name, pType, null);
+ JCVariableDecl param = maker.VarDef(maker.Modifiers(Flags.FINAL | Flags.PARAMETER, nonNulls.appendList(nullables)), field.name, pType, null);
params.append(param);
args.append(maker.Ident(field.name));
}
diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java
index 33627072..6af34f20 100644
--- a/src/core/lombok/javac/handlers/HandleDelegate.java
+++ b/src/core/lombok/javac/handlers/HandleDelegate.java
@@ -305,7 +305,7 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
int idx = 0;
for (TypeMirror param : sig.type.getParameterTypes()) {
- JCModifiers paramMods = maker.Modifiers(Flags.FINAL);
+ JCModifiers paramMods = maker.Modifiers(Flags.FINAL | Flags.PARAMETER);
String[] paramNames = sig.getParameterNames();
Name name = annotation.toName(paramNames[idx++]);
params.append(maker.VarDef(paramMods, name, JavacResolution.typeToJCTree((Type) param, annotation.getAst(), true), null));
diff --git a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
index 88ab3871..9e871b4e 100644
--- a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
+++ b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
@@ -371,7 +371,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
JCExpression returnType = maker.TypeIdent(CTC_BOOLEAN);
ListBuffer<JCStatement> statements = ListBuffer.lb();
- final List<JCVariableDecl> params = List.of(maker.VarDef(maker.Modifiers(Flags.FINAL), oName, objectType, null));
+ final List<JCVariableDecl> params = List.of(maker.VarDef(maker.Modifiers(Flags.FINAL | Flags.PARAMETER), oName, objectType, null));
/* if (o == this) return true; */ {
statements.append(maker.If(maker.Binary(CTC_EQUAL, maker.Ident(oName),
@@ -501,7 +501,7 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
Name canEqualName = typeNode.toName("canEqual");
JCExpression objectType = chainDots(typeNode, "java", "lang", "Object");
Name otherName = typeNode.toName("other");
- List<JCVariableDecl> params = List.of(maker.VarDef(maker.Modifiers(Flags.FINAL), otherName, objectType, null));
+ List<JCVariableDecl> params = List.of(maker.VarDef(maker.Modifiers(Flags.FINAL | Flags.PARAMETER), otherName, objectType, null));
JCBlock body = maker.Block(0, List.<JCStatement>of(
maker.Return(maker.TypeTest(maker.Ident(otherName), createTypeReference(typeNode)))));
diff --git a/src/core/lombok/javac/handlers/HandleSetter.java b/src/core/lombok/javac/handlers/HandleSetter.java
index 1f8caa9b..6f345418 100644
--- a/src/core/lombok/javac/handlers/HandleSetter.java
+++ b/src/core/lombok/javac/handlers/HandleSetter.java
@@ -211,7 +211,7 @@ public class HandleSetter extends JavacAnnotationHandler<Setter> {
Name methodName = field.toName(setterName);
List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(nonNulls).appendList(nullables);
- JCVariableDecl param = treeMaker.VarDef(treeMaker.Modifiers(Flags.FINAL, annsOnParam), fieldDecl.name, fieldDecl.vartype, null);
+ JCVariableDecl param = treeMaker.VarDef(treeMaker.Modifiers(Flags.FINAL | Flags.PARAMETER, annsOnParam), fieldDecl.name, fieldDecl.vartype, null);
if (nonNulls.isEmpty()) {
statements.append(treeMaker.Exec(assign));
diff --git a/src/core/lombok/javac/handlers/HandleWither.java b/src/core/lombok/javac/handlers/HandleWither.java
index 9397caa0..4bda5464 100644
--- a/src/core/lombok/javac/handlers/HandleWither.java
+++ b/src/core/lombok/javac/handlers/HandleWither.java
@@ -214,7 +214,7 @@ public class HandleWither extends JavacAnnotationHandler<Wither> {
Name methodName = field.toName(witherName);
List<JCAnnotation> annsOnParam = copyAnnotations(onParam).appendList(nonNulls).appendList(nullables);
- JCVariableDecl param = maker.VarDef(maker.Modifiers(Flags.FINAL, annsOnParam), fieldDecl.name, fieldDecl.vartype, null);
+ JCVariableDecl param = maker.VarDef(maker.Modifiers(Flags.FINAL | Flags.PARAMETER, annsOnParam), fieldDecl.name, fieldDecl.vartype, null);
JCExpression selfType = cloneSelfType(field);
if (selfType == null) return null;
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index c245d506..65997f9a 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -97,6 +97,7 @@ public class JavacHandlerUtil {
}
@Override public void scan(JCTree tree) {
+ if (tree == null) return;
setGeneratedBy(tree, source);
super.scan(tree);
}
@@ -134,10 +135,12 @@ public class JavacHandlerUtil {
}
public static <T extends JCTree> T setGeneratedBy(T node, JCTree source) {
+ if (node == null) return null;
synchronized (generatedNodes) {
if (source == null) generatedNodes.remove(node);
else generatedNodes.put(node, new WeakReference<JCTree>(source));
}
+ if (source != null) node.pos = source.pos;
return node;
}