{"action":"created","issue":{"url":"https://api.github.com/repos/fge/grappa/issues/26","labels_url":"https://api.github.com/repos/fge/grappa/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/fge/grappa/issues/26/comments","events_url":"https://api.github.com/repos/fge/grappa/issues/26/events","html_url":"https://github.com/fge/grappa/issues/26","id":71682504,"number":26,"title":"Infinite recursion regression","user":{"login":"akirschbaum","id":4007380,"avatar_url":"https://avatars.githubusercontent.com/u/4007380?v=3","gravatar_id":"","url":"https://api.github.com/users/akirschbaum","html_url":"https://github.com/akirschbaum","followers_url":"https://api.github.com/users/akirschbaum/followers","following_url":"https://api.github.com/users/akirschbaum/following{/other_user}","gists_url":"https://api.github.com/users/akirschbaum/gists{/gist_id}","starred_url":"https://api.github.com/users/akirschbaum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akirschbaum/subscriptions","organizations_url":"https://api.github.com/users/akirschbaum/orgs","repos_url":"https://api.github.com/users/akirschbaum/repos","events_url":"https://api.github.com/users/akirschbaum/events{/privacy}","received_events_url":"https://api.github.com/users/akirschbaum/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-28T19:39:47Z","updated_at":"2015-05-04T08:06:33Z","closed_at":null,"body":"The following rules do work fine with Grappa 1.0.4 but cause an infinite recursion with Grappa 2.0.0-beta.4.\r\n\r\n```\r\n    @Cached\r\n    public Rule rule2(Var<Integer> count) {\r\n        return firstOf(sequence(\"c\", count.set(0)), sequence(\"b\", rule2(count), count.set(count.getNonnull()+1), \"b\"));\r\n    }\r\n\r\n    @Cached\r\n    public Rule rule3(Var<AtomicInteger> count) {\r\n        return firstOf(sequence(\"c\", set(count, 0)), sequence(\"b\", rule3(count), set(count, count.getNonnull().get()+1), \"b\"));\r\n    }\r\n\r\n    public boolean set(Var<AtomicInteger> var, final int value) {\r\n        var.getNonnull().set(value);\r\n        return true;\r\n    }\r\n```\r\n\r\nIn neither case an infinite recursion should occur because both methods are annotated with @Cached and because in each recursion the same Var instance is provided.\r\n\r\nThe stack overflow exception is:\r\n```\r\nException in thread \"main\" java.lang.StackOverflowError\r\n\tat java.util.Arrays.deepHashCode(Arrays.java:4199)\r\n\tat org.parboiled.transform.CacheArguments.hashCode(CacheArguments.java:43)\r\n\tat java.util.HashMap.hash(HashMap.java:338)\r\n\tat java.util.HashMap.get(HashMap.java:556)\r\n\tat grappa1.app.Parser$$parboiled.string(Unknown Source)\r\n\tat grappa1.app.Parser$$parboiled.fromCharArray(Unknown Source)\r\n\tat grappa1.app.Parser$$parboiled.fromStringLiteral(Unknown Source)\r\n\tat grappa1.app.Parser$$parboiled.toRule(Unknown Source)\r\n\tat org.parboiled.BaseParser.toRules(BaseParser.java:1845)\r\n\tat grappa1.app.Parser$$parboiled.sequence(Unknown Source)\r\n\tat grappa1.app.Parser$$parboiled.sequence(Unknown Source)\r\n\tat grappa1.app.Parser$$parboiled.rule2(Unknown Source)\r\n\tat grappa1.app.Parser$$parboiled.rule2(Unknown Source)\r\n\tat grappa1.app.Parser$$parboiled.rule2(Unknown Source)\r\n\tat grappa1.app.Parser$$parboiled.rule2(Unknown Source)\r\n[...over and over again...]\r\n```"},"comment":{"url":"https://api.github.com/repos/fge/grappa/issues/comments/98621252","html_url":"https://github.com/fge/grappa/issues/26#issuecomment-98621252","issue_url":"https://api.github.com/repos/fge/grappa/issues/26","id":98621252,"user":{"login":"fge","id":550006,"avatar_url":"https://avatars.githubusercontent.com/u/550006?v=3","gravatar_id":"","url":"https://api.github.com/users/fge","html_url":"https://github.com/fge","followers_url":"https://api.github.com/users/fge/followers","following_url":"https://api.github.com/users/fge/following{/other_user}","gists_url":"https://api.github.com/users/fge/gists{/gist_id}","starred_url":"https://api.github.com/users/fge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fge/subscriptions","organizations_url":"https://api.github.com/users/fge/orgs","repos_url":"https://api.github.com/users/fge/repos","events_url":"https://api.github.com/users/fge/events{/privacy}","received_events_url":"https://api.github.com/users/fge/received_events","type":"User","site_admin":false},"created_at":"2015-05-04T08:06:33Z","updated_at":"2015-05-04T08:06:33Z","body":"OK, there's something going on here; I can't reproduce, at least not with the input which you have given.\r\n\r\nCan you provide some code which reproduces the problem for you?\r\n"}}