技术控

    今日:152| 主题:49194
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] Java and Scala's Type Systems are Unsound

[复制链接]
Deleter回忆 发表于 7 天前
4 3

立即注册CoLaBug.com会员,免费获得投稿人的专业资料,享用更多功能,玩转个人品牌!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
The Unsound Playground

  
Java and Scala's Type Systems are Unsound-1 (scala,type,关键字,scala,type,scala,typetag,scala,type,class)


Java and Scala's Type Systems are Unsound-2 (scala,type,关键字,scala,type,scala,typetag,scala,type,class)
       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 fromlegacy.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-oracle export PATH=$JAVA_HOME/bin:$PATH ### CHECK VERSION java -version ### COMPILE cat $1 >Unsound.java javac Unsound.java ### RUN java Unsound
友荐云推荐




上一篇:谈谈协程
下一篇:图解 Session(会话)
酷辣虫提示酷辣虫禁止发表任何与中华人民共和国法律有抵触的内容!所有内容由用户发布,并不代表酷辣虫的观点,酷辣虫无法对用户发布内容真实性提供任何的保证,请自行验证并承担风险与后果。如您有版权、违规等问题,请通过"联系我们"或"违规举报"告知我们处理。

19760811 发表于 7 天前
好贴,被吓尿了
回复 支持 反对

使用道具 举报

尔琴 发表于 7 天前
撸过...
回复 支持 反对

使用道具 举报

vkvln 发表于 6 天前
如果每个女朋友用一个字来代替的话,我的情史可以写一部长篇小说了。
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

我要投稿

推荐阅读

扫码访问 @iTTTTT瑞翔 的微博
回页顶回复上一篇下一篇回列表手机版
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 )|网站地图 酷辣虫

© 2001-2016 Comsenz Inc. Design: Dean. DiscuzFans.

返回顶部 返回列表