diff options
author | Martin Odersky <odersky@gmail.com> | 2008-10-31 11:33:57 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-10-31 11:33:57 +0000 |
commit | 8b014ee7d3ac702338425592c720c8811e3c9432 (patch) | |
tree | d34dc00c71380ea4a1120411bc8cc6b8e6d1593f /src/compiler/scala/tools/nsc/transform/Erasure.scala | |
parent | ffe546326a6944d4d2535f05d7c02f5b1daed744 (diff) | |
download | scala-8b014ee7d3ac702338425592c720c8811e3c9432.tar.gz scala-8b014ee7d3ac702338425592c720c8811e3c9432.tar.bz2 scala-8b014ee7d3ac702338425592c720c8811e3c9432.zip |
fixed #1460, #1467
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/Erasure.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/Erasure.scala | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index fb2b48b3b4..b919c0e2d3 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -155,9 +155,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { UnitClass -> VOID_TAG ) - def javaSig(sym: Symbol): Option[String] = - if (!needsJavaSig(sym.info)) None - else atPhase(currentRun.erasurePhase) { + def javaSig(sym: Symbol): Option[String] = atPhase(currentRun.erasurePhase) { def jsig(tp: Type): String = jsig2(false, List(), tp) @@ -234,14 +232,24 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { case AnnotatedType(_, atp, _) => jsig(atp) case _ => - jsig(erasure(tp)) + val etp = erasure(tp) + if (etp eq tp) throw new UnknownSig + else jsig(etp) } } - - //println("Java sig of "+sym+":"+sym.tpe+" is "+jsig2(true, List(), sym.info))//DEBUG - Some(jsig2(true, List(), sym.info)) + if (needsJavaSig(sym.info)) { + try { + //println("Java sig of "+sym+" is "+jsig2(true, List(), sym.info))//DEBUG + Some(jsig2(true, List(), sym.info)) + } catch { + case ex: UnknownSig => None + } + } + else None } + class UnknownSig extends Exception + /** Type reference after erasure */ def erasedTypeRef(sym: Symbol): Type = typeRef(erasure(sym.owner.tpe), sym, List()) |