diff options
author | Paul Phillips <paulp@improving.org> | 2012-05-15 10:21:26 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-05-15 11:12:40 -0700 |
commit | 317a1056cd8062331964d1bc65f1bfd945538551 (patch) | |
tree | d3682713ea5fd99579eb7240ec587cdc92bf2fed /src/compiler/scala/tools/nsc/transform/Erasure.scala | |
parent | 8a3ed4cc955dd85f37cc148265e920435b009a29 (diff) | |
download | scala-317a1056cd8062331964d1bc65f1bfd945538551.tar.gz scala-317a1056cd8062331964d1bc65f1bfd945538551.tar.bz2 scala-317a1056cd8062331964d1bc65f1bfd945538551.zip |
Removing extraneous files.
Culling accumulated unnecessary code.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/Erasure.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Erasure.scala | 51 |
1 files changed, 7 insertions, 44 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index 3de287e58c..ea66dbedd6 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -6,7 +6,6 @@ package scala.tools.nsc package transform -import scala.tools.reflect.SigParser import scala.reflect.internal.ClassfileConstants._ import scala.collection.{ mutable, immutable } import symtab._ @@ -66,16 +65,6 @@ abstract class Erasure extends AddInterfaces } } - // for debugging signatures: traces logic given system property - // performance: get the value here - val traceSignatures = (sys.BooleanProp keyExists "scalac.sigs.trace").value - private object traceSig extends util.Tracer(() => traceSignatures) { - override def stringify(x: Any) = x match { - case tp: Type => super.stringify(dropAllRefinements(tp)) - case _ => super.stringify(x) - } - } - override protected def verifyJavaErasure = settings.Xverify.value || settings.debug.value def needsJavaSig(tp: Type) = !settings.Ynogenericsig.value && NeedsSigCollector.collect(tp) @@ -173,21 +162,6 @@ abstract class Erasure extends AddInterfaces } } - /** Run the signature parser to catch bogus signatures. - */ - def isValidSignature(sym: Symbol, sig: String) = ( - /** Since we're using a sun internal class for signature validation, - * we have to allow for it not existing or otherwise malfunctioning: - * in which case we treat every signature as valid. Medium term we - * should certainly write independent signature validation. - */ - SigParser.isParserAvailable && ( - if (sym.isMethod) SigParser verifyMethod sig - else if (sym.isTerm) SigParser verifyType sig - else SigParser verifyClass sig - ) - ) - private def hiBounds(bounds: TypeBounds): List[Type] = bounds.hi.normalize match { case RefinedType(parents, _) => parents map (_.normalize) case tp => tp :: Nil @@ -199,7 +173,7 @@ abstract class Erasure extends AddInterfaces def javaSig(sym0: Symbol, info: Type): Option[String] = beforeErasure { val isTraitSignature = sym0.enclClass.isTrait - def superSig(parents: List[Type]) = traceSig("superSig", parents) { + def superSig(parents: List[Type]) = { val ps = ( if (isTraitSignature) { // java is unthrilled about seeing interfaces inherit from classes @@ -213,7 +187,7 @@ abstract class Erasure extends AddInterfaces (ps map boxedSig).mkString } def boxedSig(tp: Type) = jsig(tp, primitiveOK = false) - def boundsSig(bounds: List[Type]) = traceSig("boundsSig", bounds) { + def boundsSig(bounds: List[Type]) = { val (isTrait, isClass) = bounds partition (_.typeSymbol.isTrait) val classPart = isClass match { case Nil => ":" // + boxedSig(ObjectClass.tpe) @@ -222,7 +196,7 @@ abstract class Erasure extends AddInterfaces classPart :: (isTrait map boxedSig) mkString ":" } def paramSig(tsym: Symbol) = tsym.name + boundsSig(hiBounds(tsym.info.bounds)) - def polyParamSig(tparams: List[Symbol]) = traceSig("polyParamSig", tparams) ( + def polyParamSig(tparams: List[Symbol]) = ( if (tparams.isEmpty) "" else tparams map paramSig mkString ("<", "", ">") ) @@ -315,22 +289,11 @@ abstract class Erasure extends AddInterfaces else jsig(etp) } } - val result = traceSig("javaSig", (sym0, info)) { - if (needsJavaSig(info)) { - try Some(jsig(info, toplevel = true)) - catch { case ex: UnknownSig => None } - } - else None - } - // Debugging: immediately verify signatures when tracing. - if (traceSignatures) { - result foreach { sig => - if (!isValidSignature(sym0, sig)) - println("**** invalid signature for " + sym0 + ": " + sig) - } + if (needsJavaSig(info)) { + try Some(jsig(info, toplevel = true)) + catch { case ex: UnknownSig => None } } - - result + else None } class UnknownSig extends Exception |