The Unsound Playground

Fork me on GitHub
OOPSLA '16
Distinguished
Artifact Award

We, Nada Amin and Ross Tate, broke the Java and Scala type systems!
Try it out for yourself by running the examples, which throw cast exceptions even though they contain no casts ↓
Read our paper Java and Scala's Type Systems are Unsound to learn how these examples work →
Come up with your own examples and use the save icon to update the URL to a permalink to your code ↱

Which language would you like to break?
Java / Scala

object unsoundMini { trait A { type L >: Any} def upcast(a: A, x: Any): a.L = x val p: A { type L <: Nothing } = null def coerce(x: Any): Nothing = upcast(p, x) coerce("Uh oh!") }
#!/bin/bash set -e -v ### PICK VERSION export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 export PATH=$JAVA_HOME/bin:$PATH export SCALA_HOME=/code/scala-2.11.8 export PATH=$SCALA_HOME/bin:$PATH ### CHECK VERSION java -version scala -version ### COMPILE cat $1 >unsoundMini.scala scalac unsoundMini.scala ### RUN scala unsoundMini