Skip to content

Commit b129009

Browse files
committed
Fix #3653: generic Java signature of FunctionXXL
We were encoding the generic Java signature of `FunctionN`s' with more than P parameters as `FunctionP<..params..>` (which doesn't exist), but in the bytecode, FunctionXXL is used instead. This commit fixes that, so that the generic signature matches `FunctionXXL`.
1 parent 07fa870 commit b129009

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ object GenericSignatures {
127127
case ref @ TypeParamRef(_: PolyType, _) =>
128128
typeParamSig(ref.paramName.lastPart)
129129

130+
case RefOrAppliedType(sym, _, _) if defn.isXXLFunctionClass(sym) =>
131+
jsig(defn.FunctionXXLType, toplevel, primitiveOK)
132+
130133
case RefOrAppliedType(sym, pre, args) =>
131134
def argSig(tp: Type): Unit =
132135
tp match {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public <T> scala.FunctionXXL Foo.bar()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Foo {
2+
def bar[T] =
3+
(a0: T, a1: T, a2: T, a3: T, a4: T, a5: T, a6: T, a7: T, a8: T, a9: T,
4+
b0: T, b1: T, b2: T, b3: T, b4: T, b5: T, b6: T, b7: T, b8: T, b9: T,
5+
c0: T, c1: T, c2: T, c3: T, c4: T, c5: T, c6: T, c7: T, c8: T, c9: T) => 0
6+
}
7+
8+
object Test {
9+
def main(args: Array[String]): Unit = {
10+
val meth = classOf[Foo].getDeclaredMethod("bar")
11+
println(meth.toGenericString)
12+
}
13+
}

0 commit comments

Comments
 (0)