Skip to content

Commit 5038c9c

Browse files
committed
ClassfileParser: allow missing param names (for JDK 21)
this is a forward port of scala/scala#10397 (fixing scala/bug#12783, from which Scala 3 also suffers)
1 parent 4ffe5af commit 5038c9c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -758,10 +758,12 @@ class ClassfileParser(
758758
case tpnme.MethodParametersATTR =>
759759
val paramCount = in.nextByte
760760
for i <- 0 until paramCount do
761-
val name = pool.getName(in.nextChar)
761+
val index = in.nextChar
762762
val flags = in.nextChar
763-
if (flags & JAVA_ACC_SYNTHETIC) == 0 then
764-
res.namedParams += (i -> name.name)
763+
if index != 0 then
764+
val name = pool.getName(index)
765+
if (flags & JAVA_ACC_SYNTHETIC) == 0 then
766+
res.namedParams += (i -> name.name)
765767

766768
case tpnme.AnnotationDefaultATTR =>
767769
sym.addAnnotation(Annotation(defn.AnnotationDefaultAnnot, Nil, sym.span))

0 commit comments

Comments
 (0)