Permalink
Browse files

Don't generate redundant interfaces.

Dropped redundant parents during bytecode generation to ease
trouble on android.  Closes SI-5278.
  • Loading branch information...
paulp committed Dec 5, 2011
1 parent 3b65ef1 commit 7a99c03da1d31ac5950eecb30f422f43c5e3d04e
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -308,6 +308,18 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
private var innerClassBuffer = mutable.LinkedHashSet[Symbol]()
/** Drop redundant interfaces (ones which are implemented by some
* other parent) from the immediate parents. This is important on
* android because there is otherwise an interface explosion.
*/
private def minimizeInterfaces(interfaces: List[Symbol]): List[Symbol] = (
interfaces filterNot (int1 =>
interfaces exists (int2 =>
(int1 ne int2) && (int2 isSubClass int1)
)
)
)
def genClass(c: IClass) {
clasz = c
innerClassBuffer.clear()
@@ -322,7 +334,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
}
val ifaces = superInterfaces match {
case Nil => JClass.NO_INTERFACES
case _ => mkArray(superInterfaces map (x => javaName(x.typeSymbol)))
case _ => mkArray(minimizeInterfaces(superInterfaces map (_.typeSymbol)) map javaName)
}
jclass = fjbgContext.JClass(javaFlags(c.symbol),

0 comments on commit 7a99c03

Please sign in to comment.