{"action":"created","issue":{"url":"https://api.github.com/repos/st-js/st-js/issues/57","labels_url":"https://api.github.com/repos/st-js/st-js/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/st-js/st-js/issues/57/comments","events_url":"https://api.github.com/repos/st-js/st-js/issues/57/events","html_url":"https://github.com/st-js/st-js/issues/57","id":54199556,"number":57,"title":"Anonymous class instantiation losing it's type","user":{"login":"golanhall","id":4569642,"avatar_url":"https://avatars.githubusercontent.com/u/4569642?v=3","gravatar_id":"","url":"https://api.github.com/users/golanhall","html_url":"https://github.com/golanhall","followers_url":"https://api.github.com/users/golanhall/followers","following_url":"https://api.github.com/users/golanhall/following{/other_user}","gists_url":"https://api.github.com/users/golanhall/gists{/gist_id}","starred_url":"https://api.github.com/users/golanhall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/golanhall/subscriptions","organizations_url":"https://api.github.com/users/golanhall/orgs","repos_url":"https://api.github.com/users/golanhall/repos","events_url":"https://api.github.com/users/golanhall/events{/privacy}","received_events_url":"https://api.github.com/users/golanhall/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-13T14:29:36Z","updated_at":"2015-01-19T15:01:19Z","closed_at":null,"body":"When instantiating and overriding members or fields of a class it's type detail get lost.\r\n\r\nExample:\r\n\r\n```\r\npublic class DateWrapper {\r\n   public Date internalDate;\r\n   public long getMillis() {\r\n      return internalDate.getTime();\r\n   }\r\n   public static long staticGetMillis(DateWrapper inst) {\r\n      return inst.getMillis();\r\n   }\r\n   public static void main(String[] args) {\r\n      staticGetMillis(new DateWrapper(){{\r\n         internalDate = new Date();\r\n      }});\r\n   }\r\n}\r\n```\r\nThrows error: getMillis is not defined.\r\n\r\nThe generator outputs:\r\n```\r\nDateWrapper.staticGetMillis({internalDate: new Date()});\r\n```\r\n\r\nThus passing a untyped object to the static method. \r\nA more desired result might be: \r\n```\r\nDateWrapper.staticGetMillis(stjs.copyProps({internalDate:new Date()}, new DateWrapper()));\r\n```\r\nOR via stjs.typefy\r\n```\r\nDateWrapper.staticGetMillis(stjs.typefy({internalDate:new Date()}, new DateWrapper()));\r\n```"},"comment":{"url":"https://api.github.com/repos/st-js/st-js/issues/comments/70506716","html_url":"https://github.com/st-js/st-js/issues/57#issuecomment-70506716","issue_url":"https://api.github.com/repos/st-js/st-js/issues/57","id":70506716,"user":{"login":"npiguet","id":1618122,"avatar_url":"https://avatars.githubusercontent.com/u/1618122?v=3","gravatar_id":"","url":"https://api.github.com/users/npiguet","html_url":"https://github.com/npiguet","followers_url":"https://api.github.com/users/npiguet/followers","following_url":"https://api.github.com/users/npiguet/following{/other_user}","gists_url":"https://api.github.com/users/npiguet/gists{/gist_id}","starred_url":"https://api.github.com/users/npiguet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npiguet/subscriptions","organizations_url":"https://api.github.com/users/npiguet/orgs","repos_url":"https://api.github.com/users/npiguet/repos","events_url":"https://api.github.com/users/npiguet/events{/privacy}","received_events_url":"https://api.github.com/users/npiguet/received_events","type":"User","site_admin":false},"created_at":"2015-01-19T15:01:19Z","updated_at":"2015-01-19T15:01:19Z","body":"Note that using an anonymous class using a single pair or braces (ie: `{}` instead of `{{}}`) does maintain the type correctly."}}