@@ -657,6 +657,7 @@ class ClassfileParser(
657
657
var constant : Constant = null
658
658
var exceptions : List [NameOrString ] = Nil
659
659
var annotations : List [Annotation ] = Nil
660
+ var namedParams : Map [Int , TermName ] = Map .empty
660
661
def complete (tp : Type , isVarargs : Boolean = false )(using Context ): Type = {
661
662
val updatedType =
662
663
if sig == null then tp
@@ -680,7 +681,14 @@ class ClassfileParser(
680
681
sym.addAnnotation(ThrowsAnnotation (cls.asClass))
681
682
}
682
683
683
- cook.apply(newType)
684
+ def fillInParamNames (t : Type ): Type = t match
685
+ case mt @ MethodType (oldp) if namedParams.nonEmpty =>
686
+ mt.derivedLambdaType(List .tabulate(oldp.size)(n => namedParams.getOrElse(n, oldp(n))))
687
+ case pt : PolyType if namedParams.nonEmpty =>
688
+ pt.derivedLambdaType(pt.paramNames, pt.paramInfos, fillInParamNames(pt.resultType))
689
+ case _ => t
690
+
691
+ cook.apply(fillInParamNames(newType))
684
692
}
685
693
}
686
694
@@ -714,6 +722,14 @@ class ClassfileParser(
714
722
if (c ne null ) res.constant = c
715
723
else report.warning(s " Invalid constant in attribute of ${sym.showLocated} while parsing ${classfile}" )
716
724
725
+ case tpnme.MethodParametersATTR =>
726
+ val paramCount = in.nextByte
727
+ for i <- 0 until paramCount do
728
+ val name = pool.getName(in.nextChar)
729
+ val flags = in.nextChar
730
+ if (flags & JAVA_ACC_SYNTHETIC ) == 0 then
731
+ res.namedParams += (i -> name.name)
732
+
717
733
case tpnme.AnnotationDefaultATTR =>
718
734
sym.addAnnotation(Annotation (defn.AnnotationDefaultAnnot , Nil ))
719
735
0 commit comments