Nothing crash
Neal Gafter
neal at gafter.com
Thu May 22 20:03:22 PDT 2008
Yes, the compiler should complain if some intermediate result in an
expression is of type Nothing. It is a bug that the compiler doesn't do
that now.
Regards,
Neal
On Thu, May 22, 2008 at 4:39 PM, Mark Mahieu <mark at twistedbanana.demon.co.uk>
wrote:
> javac falls over trying to deal with this nonsense:
>
>
> public class NothingCrash {
>
> public static void main(String[] args) {
> System.out.println(nowt().toString());
> }
>
> static Nothing nowt() {
> throw new RuntimeException();
> }
> }
>
>
> java.lang.AssertionError
> at com.sun.tools.javac.jvm.Code.postop(Code.java:380)
> at com.sun.tools.javac.jvm.Code.emitop0(Code.java:862)
> at com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1712)
> at
> com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1395)
> at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:837)
> at com.sun.tools.javac.jvm.Gen.visitSelect(Gen.java:2159)
> at
> com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1945)
> at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:837)
> at com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1702)
> at
> com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1395)
> at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:837)
> at com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:862)
> at com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1706)
> at
> com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1395)
> ...
>
>
> Regards,
>
> Mark
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20080522/326da813/attachment.html
More information about the closures-dev
mailing list