summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2015-04-09 16:53:21 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-04-09 16:53:21 -0700
commit3ce8417b9ab00963c3da342d03a45ed492d6b69b (patch)
tree8d681bc9208314d53e63e230fa2aafeb869ae3da /src
parent68e05701cd9ef633f7a22b82794c81f67d45be16 (diff)
parente9bfa33c1eef822eb9d3d0f471f4bbbe390e1e65 (diff)
downloadscala-3ce8417b9ab00963c3da342d03a45ed492d6b69b.tar.gz
scala-3ce8417b9ab00963c3da342d03a45ed492d6b69b.tar.bz2
scala-3ce8417b9ab00963c3da342d03a45ed492d6b69b.zip
Merge pull request #4403 from gourlaysama/wip/t9239-generic-signature
SI-9239 fix java generic signature when traits extend classes
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index facce9062b..9fdc3a9d72 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -188,14 +188,16 @@ abstract class Erasure extends AddInterfaces
/* Drop redundant types (ones which are implemented by some other parent) from the immediate parents.
* This is important on Android because there is otherwise an interface explosion.
*/
- def minimizeParents(parents: List[Type]): List[Type] = {
- var rest = parents
- var leaves = collection.mutable.ListBuffer.empty[Type]
+ def minimizeParents(parents: List[Type]): List[Type] = if (parents.isEmpty) parents else {
+ def isInterfaceOrTrait(sym: Symbol) = sym.isInterface || sym.isTrait
+
+ var rest = parents.tail
+ var leaves = collection.mutable.ListBuffer.empty[Type] += parents.head
while(rest.nonEmpty) {
val candidate = rest.head
val nonLeaf = leaves exists { t => t.typeSymbol isSubClass candidate.typeSymbol }
if(!nonLeaf) {
- leaves = leaves filterNot { t => candidate.typeSymbol isSubClass t.typeSymbol }
+ leaves = leaves filterNot { t => isInterfaceOrTrait(t.typeSymbol) && (candidate.typeSymbol isSubClass t.typeSymbol) }
leaves += candidate
}
rest = rest.tail