diff options
author | Paul Phillips <paulp@improving.org> | 2011-10-27 18:30:09 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-10-27 18:30:09 +0000 |
commit | 09188cd820c29894d046dbd5497afc68932e60f8 (patch) | |
tree | 51759a791d34ae2ee647d150383cf9370a922bd4 /src/compiler | |
parent | daf6f0d5dd12f481cdbb41a265ec803445bfc880 (diff) | |
download | scala-09188cd820c29894d046dbd5497afc68932e60f8.tar.gz scala-09188cd820c29894d046dbd5497afc68932e60f8.tar.bz2 scala-09188cd820c29894d046dbd5497afc68932e60f8.zip |
Fix for varargs methods.
Propagate varargs flag from object methods to static forwarders so java
will recognize them as varargs.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 683ed9317d..1b6b50a793 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -1015,13 +1015,17 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with val methodInfo = module.thisType.memberInfo(m) val paramJavaTypes = methodInfo.paramTypes map javaType val paramNames = 0 until paramJavaTypes.length map ("x_" + _) + // TODO: evaluate the other flags we might be dropping on the floor here. + val flags = PublicStatic | ( + if (m.isVarargsMethod) ACC_VARARGS else 0 + ) /** Forwarders must not be marked final, as the JVM will not allow * redefinition of a final static method, and we don't know what classes * might be subclassing the companion class. See SI-4827. */ val mirrorMethod = jclass.addNewMethod( - PublicStatic, + flags, javaName(m), javaType(methodInfo.resultType), mkArray(paramJavaTypes), |