From 5038c9c4401e9922e0d5fa11369981f722be0d9c Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Thu, 18 May 2023 14:39:56 -0700 Subject: [PATCH] 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) --- .../dotty/tools/dotc/core/classfile/ClassfileParser.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index eeeb3767bd34..0c701eb03d38 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -758,10 +758,12 @@ class ClassfileParser( case tpnme.MethodParametersATTR => val paramCount = in.nextByte for i <- 0 until paramCount do - val name = pool.getName(in.nextChar) + val index = in.nextChar val flags = in.nextChar - if (flags & JAVA_ACC_SYNTHETIC) == 0 then - res.namedParams += (i -> name.name) + if index != 0 then + val name = pool.getName(index) + if (flags & JAVA_ACC_SYNTHETIC) == 0 then + res.namedParams += (i -> name.name) case tpnme.AnnotationDefaultATTR => sym.addAnnotation(Annotation(defn.AnnotationDefaultAnnot, Nil, sym.span))