aboutsummaryrefslogtreecommitdiff
path: root/src/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-08-27 22:19:29 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-08-27 22:19:29 +0200
commit7c786f5af61185983940cad794fe2cb50d426005 (patch)
treed43e9ab3629cc4944f05780f82126bad11d96ff5 /src/lombok
parent8aab4e60d62eaad04f5df8fb78621d53d12da2db (diff)
downloadlombok-7c786f5af61185983940cad794fe2cb50d426005.tar.gz
lombok-7c786f5af61185983940cad794fe2cb50d426005.tar.bz2
lombok-7c786f5af61185983940cad794fe2cb50d426005.zip
Made all parameters of all generated methods 'final'.
Diffstat (limited to 'src/lombok')
-rw-r--r--src/lombok/eclipse/handlers/HandleData.java4
-rw-r--r--src/lombok/eclipse/handlers/HandleEqualsAndHashCode.java4
-rw-r--r--src/lombok/eclipse/handlers/HandleSetter.java5
-rw-r--r--src/lombok/javac/handlers/HandleData.java4
-rw-r--r--src/lombok/javac/handlers/HandleEqualsAndHashCode.java2
-rw-r--r--src/lombok/javac/handlers/HandleSetter.java2
6 files changed, 12 insertions, 9 deletions
diff --git a/src/lombok/eclipse/handlers/HandleData.java b/src/lombok/eclipse/handlers/HandleData.java
index f1623e39..b598313b 100644
--- a/src/lombok/eclipse/handlers/HandleData.java
+++ b/src/lombok/eclipse/handlers/HandleData.java
@@ -147,7 +147,7 @@ public class HandleData implements EclipseAnnotationHandler<Data> {
thisX.token = field.name;
assigns.add(new Assignment(thisX, new SingleNameReference(field.name, p), (int)p));
long fieldPos = (((long)field.sourceStart) << 32) | field.sourceEnd;
- args.add(new Argument(field.name, fieldPos, copyType(field.type), 0));
+ args.add(new Argument(field.name, fieldPos, copyType(field.type), Modifier.FINAL));
}
constructor.statements = assigns.isEmpty() ? null : assigns.toArray(new Statement[assigns.size()]);
@@ -188,7 +188,7 @@ public class HandleData implements EclipseAnnotationHandler<Data> {
FieldDeclaration field = (FieldDeclaration) fieldNode.get();
long fieldPos = (((long)field.sourceStart) << 32) | field.sourceEnd;
assigns.add(new SingleNameReference(field.name, fieldPos));
- args.add(new Argument(field.name, fieldPos, copyType(field.type), 0));
+ args.add(new Argument(field.name, fieldPos, copyType(field.type), Modifier.FINAL));
}
statement.arguments = assigns.isEmpty() ? null : assigns.toArray(new Expression[assigns.size()]);
diff --git a/src/lombok/eclipse/handlers/HandleEqualsAndHashCode.java b/src/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
index c94fde76..b8916d46 100644
--- a/src/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
+++ b/src/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
@@ -244,7 +244,7 @@ public class HandleEqualsAndHashCode implements EclipseAnnotationHandler<EqualsA
/* Without fields, PRIME isn't used, and that would trigger a 'local variable not used' warning. */
if ( !isEmpty || callSuper ) {
LocalDeclaration primeDecl = new LocalDeclaration(PRIME, 0 ,0);
- primeDecl.modifiers = Modifier.FINAL;
+ primeDecl.modifiers |= Modifier.FINAL;
primeDecl.type = TypeReference.baseTypeReference(TypeIds.T_int, 0);
primeDecl.initialization = new IntLiteral("31".toCharArray(), 0, 0);
statements.add(primeDecl);
@@ -364,7 +364,7 @@ public class HandleEqualsAndHashCode implements EclipseAnnotationHandler<EqualsA
method.bodyEnd = method.declarationSourceEnd = method.sourceEnd = pos.sourceEnd;
method.arguments = new Argument[] {
new Argument(new char[] { 'o' }, 0,
- new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, new long[] { 0, 0, 0 }), 0)
+ new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, new long[] { 0, 0, 0 }), Modifier.FINAL)
};
List<Statement> statements = new ArrayList<Statement>();
diff --git a/src/lombok/eclipse/handlers/HandleSetter.java b/src/lombok/eclipse/handlers/HandleSetter.java
index adac30d7..1e301c29 100644
--- a/src/lombok/eclipse/handlers/HandleSetter.java
+++ b/src/lombok/eclipse/handlers/HandleSetter.java
@@ -22,6 +22,9 @@
package lombok.eclipse.handlers;
import static lombok.eclipse.handlers.PKG.*;
+
+import java.lang.reflect.Modifier;
+
import lombok.AccessLevel;
import lombok.Setter;
import lombok.core.AnnotationValues;
@@ -124,7 +127,7 @@ public class HandleSetter implements EclipseAnnotationHandler<Setter> {
method.modifiers = modifier;
method.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0);
method.annotations = null;
- Argument param = new Argument(field.name, pos, Eclipse.copyType(field.type), 0);
+ Argument param = new Argument(field.name, pos, Eclipse.copyType(field.type), Modifier.FINAL);
method.arguments = new Argument[] { param };
method.selector = name.toCharArray();
method.binding = null;
diff --git a/src/lombok/javac/handlers/HandleData.java b/src/lombok/javac/handlers/HandleData.java
index 003b8808..7b094106 100644
--- a/src/lombok/javac/handlers/HandleData.java
+++ b/src/lombok/javac/handlers/HandleData.java
@@ -111,7 +111,7 @@ public class HandleData implements JavacAnnotationHandler<Data> {
for ( Node fieldNode : fields ) {
JCVariableDecl field = (JCVariableDecl) fieldNode.get();
- JCVariableDecl param = maker.VarDef(maker.Modifiers(0), field.name, field.vartype, null);
+ JCVariableDecl param = maker.VarDef(maker.Modifiers(Flags.FINAL), field.name, field.vartype, null);
params = params.append(param);
JCFieldAccess thisX = maker.Select(maker.Ident(fieldNode.toName("this")), field.name);
JCAssign assign = maker.Assign(thisX, maker.Ident(field.name));
@@ -160,7 +160,7 @@ public class HandleData implements JavacAnnotationHandler<Data> {
for ( JCExpression arg : typeApply.arguments ) tArgs = tArgs.append(arg);
pType = maker.TypeApply(typeApply.clazz, tArgs);
} else pType = field.vartype;
- JCVariableDecl param = maker.VarDef(maker.Modifiers(0), field.name, pType, null);
+ JCVariableDecl param = maker.VarDef(maker.Modifiers(Flags.FINAL), field.name, pType, null);
params = params.append(param);
args = args.append(maker.Ident(field.name));
}
diff --git a/src/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/lombok/javac/handlers/HandleEqualsAndHashCode.java
index 18202eb5..efc154f6 100644
--- a/src/lombok/javac/handlers/HandleEqualsAndHashCode.java
+++ b/src/lombok/javac/handlers/HandleEqualsAndHashCode.java
@@ -313,7 +313,7 @@ public class HandleEqualsAndHashCode implements JavacAnnotationHandler<EqualsAnd
JCExpression returnType = maker.TypeIdent(TypeTags.BOOLEAN);
List<JCStatement> statements = List.nil();
- List<JCVariableDecl> params = List.of(maker.VarDef(maker.Modifiers(0), oName, objectType, null));
+ List<JCVariableDecl> params = List.of(maker.VarDef(maker.Modifiers(Flags.FINAL), oName, objectType, null));
/* if ( o == this ) return true; */ {
statements = statements.append(
diff --git a/src/lombok/javac/handlers/HandleSetter.java b/src/lombok/javac/handlers/HandleSetter.java
index d11b4250..2e25ee57 100644
--- a/src/lombok/javac/handlers/HandleSetter.java
+++ b/src/lombok/javac/handlers/HandleSetter.java
@@ -121,7 +121,7 @@ public class HandleSetter implements JavacAnnotationHandler<Setter> {
JCBlock methodBody = treeMaker.Block(0, List.<JCStatement>of(treeMaker.Exec(assign)));
Name methodName = field.toName(toSetterName(fieldDecl));
- JCVariableDecl param = treeMaker.VarDef(treeMaker.Modifiers(0), fieldDecl.name, fieldDecl.vartype, null);
+ JCVariableDecl param = treeMaker.VarDef(treeMaker.Modifiers(Flags.FINAL), fieldDecl.name, fieldDecl.vartype, null);
JCExpression methodType = treeMaker.Type(field.getSymbolTable().voidType);
List<JCTypeParameter> methodGenericParams = List.nil();