diff options
author | Paul Phillips <paulp@improving.org> | 2011-12-05 07:34:02 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-12-05 08:16:33 -0800 |
commit | 7a99c03da1d31ac5950eecb30f422f43c5e3d04e (patch) | |
tree | 64c5b90cce6aec483ddc73dc22e12d16da5ff84d /src/compiler | |
parent | 3b65ef1c8777509c46c241bdb4ef5764d1194b0c (diff) | |
download | scala-7a99c03da1d31ac5950eecb30f422f43c5e3d04e.tar.gz scala-7a99c03da1d31ac5950eecb30f422f43c5e3d04e.tar.bz2 scala-7a99c03da1d31ac5950eecb30f422f43c5e3d04e.zip |
Don't generate redundant interfaces.
Dropped redundant parents during bytecode generation to ease
trouble on android. Closes SI-5278.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 3fe5b83515..3fa5158a4a 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/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), |