unrestricted closures

Vladimir Kirichenko vladimir.kirichenko at gmail.com
Sat Nov 15 19:26:29 PST 2008


More accurate problematic example:

public class Test {

          static {int ==> int} temp;

          static void term() {
                  {int==>int} t = {int i ==> if (i > 5) return; i};
                  temp = t;

          }

          static int m(int i, {int ==> int} f) {
                  int y = f.invoke(i + 5);
                  return y;
          }

          static int caller(int i) {
                  return m(i,temp);
          }
          public static void main(String... args) {
                  term();
                  int x = caller(5);
                  System.out.println(x);
          }
}

Exception in thread "main" java.lang.UnmatchedTransfer: late transfer
          at java.lang.Jump.transfer(Jump.java:48)
          at test.Test$3.+invoke(Test.java:12)
          at test.Test$3.invoke(Test.java:12)
          at test.Test.m(Test.java:18)
          at test.Test.caller(Test.java:23)
          at test.Test.main(Test.java:29)
Caused by: test.Test$2

And it's not the bug - code like this could appear in different cases,
it just shows what unrestricted closures passing could raise.


-- 
Best Regards,
Vladimir Kirichenko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20081116/8159e6fd/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20081116/8159e6fd/attachment-0001.bin 


More information about the closures-dev mailing list