Skip to content

Instantly share code, notes, and snippets.

@fwbrasil
Created March 16, 2014 12:29
Show Gist options
  • Save fwbrasil/9582504 to your computer and use it in GitHub Desktop.
Save fwbrasil/9582504 to your computer and use it in GitHub Desktop.
TypeTag issue
import scala.reflect.runtime.universe._
object Main extends App {
trait SomeTrait
def doSomething[T: TypeTag] =
typeTag[T].tpe
val threads = List.fill(100) {
new Thread {
override def run =
for (i <- 0 until 100)
doSomething[SomeTrait]
}
}
threads.foreach(_.start)
threads.foreach(_.join)
}
@joescii
Copy link

joescii commented Mar 16, 2014

That's interesting. I've not used the Scala reflection library (yet). Perhaps that is why I haven't encountered such a problem. Thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment