Created
March 16, 2014 12:29
-
-
Save fwbrasil/9582504 to your computer and use it in GitHub Desktop.
TypeTag issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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!