summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2015-06-16 17:00:25 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-06-16 17:18:32 -0700
commitf8fbd5dbf031a04343c795cfa99cf768add65f05 (patch)
treeed46b1c5ae252ff4aba2ed006c7f414fb528221f /src
parent43a56fb5a1b6450ce2bdf8f73ab30ca1b16d0778 (diff)
downloadscala-f8fbd5dbf031a04343c795cfa99cf768add65f05.tar.gz
scala-f8fbd5dbf031a04343c795cfa99cf768add65f05.tar.bz2
scala-f8fbd5dbf031a04343c795cfa99cf768add65f05.zip
SI-9356 more careful assertion in back-end
Calling `exists` on a `Symbol` triggers unpickling, which failed for reasons I did not investigate. Replaced `sym.exists` by `sym != NoSymbol`, which is good enough here. Also replaced assertion by a `devWarning`, since the logic seems too ad-hoc to actually crash the compiler when it's invalidated. Partially reverts b45a91fe22. See also #1532.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
index f866c0d038..76af40b330 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala
@@ -617,18 +617,16 @@ abstract class GenASM extends SubComponent with BytecodeWriters { self =>
val internalName = cachedJN.toString()
val trackedSym = jsymbol(sym)
reverseJavaName.get(internalName) match {
- case Some(oldsym) if oldsym.exists && trackedSym.exists =>
- assert(
- // In contrast, neither NothingClass nor NullClass show up bytecode-level.
- (oldsym == trackedSym) || (oldsym == RuntimeNothingClass) || (oldsym == RuntimeNullClass) || (oldsym.isModuleClass && (oldsym.sourceModule == trackedSym.sourceModule)),
- s"""|Different class symbols have the same bytecode-level internal name:
- | name: $internalName
- | oldsym: ${oldsym.fullNameString}
- | tracked: ${trackedSym.fullNameString}
- """.stripMargin
- )
- case _ =>
+ case None =>
reverseJavaName.put(internalName, trackedSym)
+ case Some(oldsym) =>
+ // TODO: `duplicateOk` seems pretty ad-hoc (a more aggressive version caused SI-9356 because it called oldSym.exists, which failed in the unpickler; see also SI-5031)
+ def duplicateOk = oldsym == NoSymbol || trackedSym == NoSymbol || (syntheticCoreClasses contains oldsym) || (oldsym.isModuleClass && (oldsym.sourceModule == trackedSym.sourceModule))
+ if (oldsym != trackedSym && !duplicateOk)
+ devWarning(s"""|Different class symbols have the same bytecode-level internal name:
+ | name: $internalName
+ | oldsym: ${oldsym.fullNameString}
+ | tracked: ${trackedSym.fullNameString}""".stripMargin)
}
}