File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
compiler/src/dotty/tools/dotc/transform
tests/generic-java-signatures Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -239,8 +239,13 @@ object GenericSignatures {
239239 methodResultSig(restpe)
240240
241241 case mtpe : MethodType =>
242- // phantom method parameters do not make it to the bytecode.
243- val params = mtpe.paramInfoss.flatten.filterNot(_.isPhantom)
242+ // unused method parameters do not make it to the bytecode.
243+ def effectiveParamInfoss (t : Type )(implicit ctx : Context ): List [List [Type ]] = t match {
244+ case t : MethodType if t.isUnusedMethod => effectiveParamInfoss(t.resType)
245+ case t : MethodType => t.paramInfos.filterNot(_.isPhantom) :: effectiveParamInfoss(t.resType)
246+ case _ => Nil
247+ }
248+ val params = effectiveParamInfoss(mtpe).flatten
244249 val restpe = mtpe.finalResultType
245250 builder.append('(' )
246251 // TODO: Update once we support varargs
Original file line number Diff line number Diff line change 1+ public <U> int MyUnused$.f1()
2+ U <: java.lang.Object
Original file line number Diff line number Diff line change 1+ object MyUnused {
2+ def f1 [U ](unused a : Int ): Int = 0
3+ }
4+
5+ object Test {
6+ def main (args : Array [String ]): Unit = {
7+ val f1 = MyUnused .getClass.getMethods.find(_.getName.endsWith(" f1" )).get
8+ val tParams = f1.getTypeParameters
9+ println(f1.toGenericString)
10+ tParams.foreach { tp =>
11+ println(tp.getName + " <: " + tp.getBounds.map(_.getTypeName).mkString(" , " ))
12+ }
13+ }
14+ }
You can’t perform that action at this time.
0 commit comments