diff options
author | Martin Odersky <odersky@gmail.com> | 2011-03-22 22:59:03 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-03-22 22:59:03 +0000 |
commit | 413feab04ce1afe05b3bd60c084f5c5c3ad8ba4a (patch) | |
tree | f626a53d131c9298f71637504bf043b2f0144cbe /src | |
parent | 142405e1dd623e965e7ce5a3bc4fa019bc3262fa (diff) | |
download | scala-413feab04ce1afe05b3bd60c084f5c5c3ad8ba4a.tar.gz scala-413feab04ce1afe05b3bd60c084f5c5c3ad8ba4a.tar.bz2 scala-413feab04ce1afe05b3bd60c084f5c5c3ad8ba4a.zip |
Better signature avoidance. Review by extempore.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 11 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Erasure.scala | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index fb253d1ddc..b8aa8d7a8f 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -573,9 +573,9 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid { * should certainly write independent signature validation. */ if (SigParser.isParserAvailable && isValidSignature(sym, sig)) { - val normalizedTpe = erasure.prepareSigMap(memberTpe) + val normalizedTpe = atPhase(currentRun.erasurePhase)(erasure.prepareSigMap(memberTpe)) val bytecodeTpe = owner.thisType.memberInfo(sym) - if (erasure.erasure(normalizedTpe) =:= bytecodeTpe) { + if (sym.isType || (erasure.erasure(normalizedTpe) =:= bytecodeTpe)) { val index = jmember.getConstantPool.addUtf8(sig).toShort if (opt.verboseDebug) atPhase(currentRun.erasurePhase) { @@ -584,12 +584,17 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid { val buf = ByteBuffer.allocate(2) buf putShort index addAttribute(jmember, tpnme.SignatureATTR, buf) - } else clasz.cunit.warning(sym.pos, + } else { + if (sym.hasFlag(Flags.MIXEDIN)) + ()// println("suppressing signature for mixedin "+sym) + else + clasz.cunit.warning(sym.pos, """|compiler bug: created generic signature for %s in %s that does not conform to its erasure |signature: %s |erasure type: %s |if this is reproducible, please report bug at http://lampsvn.epfl.ch/trac/scala """.trim.stripMargin.format(sym, sym.owner.skipPackageObject.fullName, sig, bytecodeTpe)) + } } else clasz.cunit.warning(sym.pos, """|compiler bug: created invalid generic signature for %s in %s |signature: %s diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 00ef2279d6..bdc0a1bfac 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -254,7 +254,7 @@ abstract class Erasure extends AddInterfaces else squashBoxed(tp1) } if (sym == ArrayClass && args.nonEmpty) - if (unboundedGenericArrayLevel(tp) == 1) ObjectClass.tpe + if (unboundedGenericArrayLevel(tp1) == 1) ObjectClass.tpe else mapOver(tp1) else if (sym == AnyClass || sym == AnyValClass || sym == SingletonClass) ObjectClass.tpe @@ -353,8 +353,6 @@ abstract class Erasure extends AddInterfaces jsig(RuntimeNothingClass.tpe) else if (sym == NullClass) jsig(RuntimeNullClass.tpe) - else if (isValueClass(sym)) - jsig(ObjectClass.tpe) else if (sym.isClass) { val preRebound = pre.baseType(sym.owner) // #2585 traceSig.seq("sym.isClass", Seq(sym.ownerChain, preRebound, sym0.enclClassChain)) { |