--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon Dec 13 14:08:01 2010 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon Dec 13 15:11:00 2010 -0800
@@ -105,10 +105,15 @@
*/
boolean allowAnnotations;
- /** Lint option: warn about classfile issues
+ /** Switch: allow simplified varargs.
+ */
+ boolean allowSimplifiedVarargs;
+
+ /** Lint option: warn about classfile issues
*/
boolean lintClassfile;
+
/** Switch: preserve parameter names from the variable table.
*/
public boolean saveParameterNames;
@@ -279,6 +284,7 @@
allowGenerics = source.allowGenerics();
allowVarargs = source.allowVarargs();
allowAnnotations = source.allowAnnotations();
+ allowSimplifiedVarargs = source.allowSimplifiedVarargs();
saveParameterNames = options.isSet("save-parameter-names");
cacheCompletionFailure = options.isUnset("dev");
preferSource = "source".equals(options.get("-Xprefer"));
@@ -1883,7 +1889,7 @@
// instance, however, there is no reliable way to tell so
// we never strip this$n
if (!currentOwner.name.isEmpty())
- type = new MethodType(type.getParameterTypes().tail,
+ type = new MethodType(adjustMethodParams(flags, type.getParameterTypes()),
type.getReturnType(),
type.getThrownTypes(),
syms.methodClass);
@@ -1903,6 +1909,21 @@
return m;
}
+ private List<Type> adjustMethodParams(long flags, List<Type> args) {
+ boolean isVarargs = (flags & VARARGS) != 0;
+ if (isVarargs) {
+ Type varargsElem = args.last();
+ ListBuffer<Type> adjustedArgs = ListBuffer.lb();
+ for (Type t : args) {
+ adjustedArgs.append(t != varargsElem ?
+ t :
+ ((ArrayType)t).makeVarargs());
+ }
+ args = adjustedArgs.toList();
+ }
+ return args.tail;
+ }
+
/**
* Init the parameter names array.
* Parameter names are currently inferred from the names in the