http://io.livecode.ch/learn/namin/unsound
The Unsound Playground
Fork me on GitHub
[unsound-oo] 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
* Unsound.java in Java 8 (the first program we broke Java with,
derived from legacy.scala)
* Unsound.java in Java 9 (sometimes compilers incorrectly reject
valid code)
* Unsound9.java in Java 9 (we even broke Java in the future)
* UnsoundSpec.java in Java 6 (incorrectly rejected unsound program
that has been valid since Java 5 in 2004)
* Nullless.java in Java 8 (this program has no occurence of null)
* SingleParameters.java in Java 8 (every class and method in this
program has exactly one parameter)
class Unsound { static class Constrain {} static
class Bind { A upcast(Constrain constrain, B b)
{ return b; } } static U coerce(T t) { Constrain
constrain = null; Bind bind = new Bind(); return bind.upcast
(constrain, t); } public static void main(String[] args) { String
zero = Unsound.coerce(0); } }
#!/bin/bash set -e -v ### PICK VERSION export JAVA_HOME=/usr/lib/jvm/
java-8-openjdk-amd64 export PATH=$JAVA_HOME/bin:$PATH ### CHECK
VERSION java -version ### COMPILE cat $1 >Unsound.java javac
Unsound.java ### RUN java Unsound
powered by io.livecode.ch