aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2015-12-18 20:17:47 +0100
committerRoel Spilker <r.spilker@gmail.com>2015-12-18 20:17:47 +0100
commit34a6fd644f6036bef5c2d94d925b6cf8e20ab17d (patch)
treeea2fb595c6fa804ed1b5c87541536687c29a2a63 /src
parentd3c79494a32d439b6a936d24c8440e893fc2cb50 (diff)
downloadlombok-34a6fd644f6036bef5c2d94d925b6cf8e20ab17d.tar.gz
lombok-34a6fd644f6036bef5c2d94d925b6cf8e20ab17d.tar.bz2
lombok-34a6fd644f6036bef5c2d94d925b6cf8e20ab17d.zip
fix issue #932: `@Delegate` would not generate varargs on javac
Diffstat (limited to 'src')
-rw-r--r--src/core/lombok/javac/handlers/HandleDelegate.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/lombok/javac/handlers/HandleDelegate.java b/src/core/lombok/javac/handlers/HandleDelegate.java
index fc3c81f3..680e7745 100644
--- a/src/core/lombok/javac/handlers/HandleDelegate.java
+++ b/src/core/lombok/javac/handlers/HandleDelegate.java
@@ -299,7 +299,7 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
annotations = com.sun.tools.javac.util.List.nil();
}
- JCModifiers mods = maker.Modifiers(Flags.PUBLIC, annotations);
+ JCModifiers mods = maker.Modifiers(PUBLIC, annotations);
JCExpression returnType = JavacResolution.typeToJCTree((Type) sig.type.getReturnType(), annotation.getAst(), true);
boolean useReturn = sig.type.getReturnType().getKind() != TypeKind.VOID;
ListBuffer<JCVariableDecl> params = sig.type.getParameterTypes().isEmpty() ? null : new ListBuffer<JCVariableDecl>();
@@ -326,11 +326,15 @@ public class HandleDelegate extends JavacAnnotationHandler<Delegate> {
}
int idx = 0;
+ String[] paramNames = sig.getParameterNames();
+ boolean varargs = sig.elem.isVarArgs();
for (TypeMirror param : sig.type.getParameterTypes()) {
long flags = JavacHandlerUtil.addFinalIfNeeded(Flags.PARAMETER, annotation.getContext());
JCModifiers paramMods = maker.Modifiers(flags);
- String[] paramNames = sig.getParameterNames();
Name name = annotation.toName(paramNames[idx++]);
+ if (varargs && idx == paramNames.length) {
+ paramMods.flags |= VARARGS;
+ }
params.append(maker.VarDef(paramMods, name, JavacResolution.typeToJCTree((Type) param, annotation.getAst(), true), null));
args.append(maker.Ident(name));
}