diff --git a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala index 1e09d54c266e..ac4b108d3391 100644 --- a/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala +++ b/compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala @@ -23,6 +23,19 @@ object ClassfileParser { /** Indicate that there is nothing to unpickle and the corresponding symbols can * be invalidated. */ object NoEmbedded extends Embedded + + /** Replace raw types with wildcard applications */ + def cook(implicit ctx: Context) = new TypeMap { + def apply(tp: Type): Type = tp match { + case tp: TypeRef if tp.symbol.typeParams.nonEmpty => + AppliedType(tp, tp.symbol.typeParams.map(Function.const(TypeBounds.empty))) + case tp @ AppliedType(tycon, args) => + // disregard tycon itself, but map over it to visit the prefix + tp.derivedAppliedType(mapOver(tycon), args.mapConserve(this)) + case _ => + mapOver(tp) + } + } } class ClassfileParser( @@ -241,7 +254,7 @@ class ClassfileParser( addConstructorTypeParams(denot) } - denot.info = pool.getType(in.nextChar) + denot.info = cook.apply(pool.getType(in.nextChar)) if (isEnum) denot.info = ConstantType(Constant(sym)) if (isConstructor) normalizeConstructorParams() setPrivateWithin(denot, jflags) diff --git a/tests/pos/i3273/Foo_1.java b/tests/pos/i3273/Foo_1.java new file mode 100644 index 000000000000..379e34dbf216 --- /dev/null +++ b/tests/pos/i3273/Foo_1.java @@ -0,0 +1,3 @@ +interface Foo_1 { + void foo(java.util.List list); +} diff --git a/tests/pos/i3273/Test_2.scala b/tests/pos/i3273/Test_2.scala new file mode 100644 index 000000000000..adc5e362493c --- /dev/null +++ b/tests/pos/i3273/Test_2.scala @@ -0,0 +1,3 @@ +class Test extends Foo_1 { + override def foo(list: java.util.List[_]): Unit = ??? +}