Skip to content

Commit 0f78102

Browse files
committed
Fix Java generic signatures for aliases
1 parent 3a6a949 commit 0f78102

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala

+2-4
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ object GenericSignatures {
455455
private class NeedsSigCollector(using Context) extends TypeAccumulator[Boolean] {
456456
override def apply(x: Boolean, tp: Type): Boolean =
457457
if (!x)
458-
tp match {
458+
tp.dealias match {
459459
case RefinedType(parent, refinedName, refinedInfo) =>
460460
val sym = parent.typeSymbol
461461
if (sym == defn.ArrayClass) foldOver(x, refinedInfo)
@@ -471,9 +471,7 @@ object GenericSignatures {
471471
foldOver(tp.typeParams.nonEmpty, parents)
472472
case AnnotatedType(tpe, _) =>
473473
foldOver(x, tpe)
474-
case proxy: TypeProxy =>
475-
foldOver(x, proxy)
476-
case _ =>
474+
case tp =>
477475
foldOver(x, tp)
478476
}
479477
else x
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
scala.collection.immutable.List<java.lang.String>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Foo {
2+
type A = List[String]
3+
def foo(): A = Nil
4+
}
5+
6+
object Test {
7+
def main(args: Array[String]): Unit = {
8+
println(classOf[Foo].getDeclaredMethod("foo").getGenericReturnType)
9+
}
10+
}

0 commit comments

Comments
 (0)