diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index 10c8a9051199..870ef6c8bf8d 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -461,11 +461,17 @@ class ClassfileParser( val ts = new ListBuffer[Type] while (sig(index) == ':') { index += 1 - if (sig(index) != ':') // guard against empty class bound - ts += sig2type(tparams, skiptvs) + if (sig(index) != ':') { // guard against empty class bound + val tp = sig2type(tparams, skiptvs) + if (!skiptvs) + ts += cook(tp) + } + } + if (!skiptvs) { + val bound = if ts.isEmpty then defn.AnyType else ts.reduceLeft(AndType.apply) + TypeBounds.upper(bound) } - val bound = if ts.isEmpty then defn.AnyType else ts.reduceLeft(AndType.apply) - TypeBounds.upper(bound) + else NoType } var tparams = classTParams diff --git a/tests/pos-java-interop-separate/i10225/A_1.java b/tests/pos-java-interop-separate/i10225/A_1.java new file mode 100644 index 000000000000..2be9eb8680eb --- /dev/null +++ b/tests/pos-java-interop-separate/i10225/A_1.java @@ -0,0 +1 @@ +class A_1 {} diff --git a/tests/pos-java-interop-separate/i10225/B_1.java b/tests/pos-java-interop-separate/i10225/B_1.java new file mode 100644 index 000000000000..e3b96c798d15 --- /dev/null +++ b/tests/pos-java-interop-separate/i10225/B_1.java @@ -0,0 +1,3 @@ +class B_1 { + public B_1(S s) { } +} diff --git a/tests/pos-java-interop-separate/i10225/Test_2.scala b/tests/pos-java-interop-separate/i10225/Test_2.scala new file mode 100644 index 000000000000..959bc72add3b --- /dev/null +++ b/tests/pos-java-interop-separate/i10225/Test_2.scala @@ -0,0 +1,4 @@ +object Test { + val a = new A_1[String] + val b = new B_1(a) +}