{"action":"created","issue":{"url":"https://api.github.com/repos/c2nes/javalang/issues/46","repository_url":"https://api.github.com/repos/c2nes/javalang","labels_url":"https://api.github.com/repos/c2nes/javalang/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/c2nes/javalang/issues/46/comments","events_url":"https://api.github.com/repos/c2nes/javalang/issues/46/events","html_url":"https://github.com/c2nes/javalang/issues/46","id":252239253,"number":46,"title":"How do I get a method's parameter's type?","user":{"login":"foresightyj","id":1296736,"avatar_url":"https://avatars2.githubusercontent.com/u/1296736?v=4","gravatar_id":"","url":"https://api.github.com/users/foresightyj","html_url":"https://github.com/foresightyj","followers_url":"https://api.github.com/users/foresightyj/followers","following_url":"https://api.github.com/users/foresightyj/following{/other_user}","gists_url":"https://api.github.com/users/foresightyj/gists{/gist_id}","starred_url":"https://api.github.com/users/foresightyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foresightyj/subscriptions","organizations_url":"https://api.github.com/users/foresightyj/orgs","repos_url":"https://api.github.com/users/foresightyj/repos","events_url":"https://api.github.com/users/foresightyj/events{/privacy}","received_events_url":"https://api.github.com/users/foresightyj/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-08-23T10:48:13Z","updated_at":"2017-08-24T02:39:55Z","closed_at":"2017-08-24T02:39:55Z","body":"This is my code:\r\n\r\n    fht_android_src = \"E:/FHT Mobile/Android/fht/app/src/main/java/com/fht360/fht\"\r\n\r\n    for (dirpath, dirname, filenames) in os.walk(fht_android_src):\r\n        for filename in filenames:\r\n            if filename.endswith(\".java\"):\r\n                filepath = os.path.join(dirpath, filename)\r\n                # see https://stackoverflow.com/questions/19591458/python-reading-from-a-file-and-saving-to-utf-8\r\n                if filename == \"MainActivity.java\":\r\n                    with io.open(filepath, 'r', encoding=\"utf8\") as f:\r\n                        content = f.read()\r\n                        tree = javalang.parse.parse(content)\r\n                        for path, node in tree:\r\n                            # if isinstance(node, javalang.tree.ClassDeclaration):\r\n                            #     # print(path, node)\r\n                            #     print(node.name)\r\n                            if isinstance(node, javalang.tree.MethodDeclaration):\r\n                                # print(path, node)\r\n                                if node.name == \"onEvent\":\r\n                                    handlerNode = node\r\n                                    handlerPath = path\r\n                                    print(handlerNode.parameters[0].type, handlerNode.parameters[0].name)\r\n\r\nI am analyzing a typical Android Activity class, which have a bunch of `onEvent` methods for EventBus, these methods look like:\r\n\r\n    public void onEvent(UnreadChatMessageEvent event) {\r\n        mNavFragment.showHomeDot(event.count);\r\n\r\n        SPUtil.saveInteger(this, Constant.UnReadChatMessage, event.count);\r\n        doTotalCount();\r\n    }\r\n\r\n    public void onEvent(FriendRequestMsgDotClearEvent event) {\r\n        mNavFragment.showFriendsDot(0);\r\n\r\n        SPUtil.saveInteger(this, Constant.UntreatedFriendRequest, 0);\r\n        doTotalCount();\r\n    }\r\n\r\nI want to get the type of the notification as something like: `UnreadChatMessageEvent`, but the type given by javalang is always `ReferenceType`:\r\n\r\n![image](https://user-images.githubusercontent.com/1296736/29612365-96ff0cd6-8833-11e7-9d48-ad4be08b99d6.png)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/c2nes/javalang/issues/comments/324516617","html_url":"https://github.com/c2nes/javalang/issues/46#issuecomment-324516617","issue_url":"https://api.github.com/repos/c2nes/javalang/issues/46","id":324516617,"user":{"login":"foresightyj","id":1296736,"avatar_url":"https://avatars2.githubusercontent.com/u/1296736?v=4","gravatar_id":"","url":"https://api.github.com/users/foresightyj","html_url":"https://github.com/foresightyj","followers_url":"https://api.github.com/users/foresightyj/followers","following_url":"https://api.github.com/users/foresightyj/following{/other_user}","gists_url":"https://api.github.com/users/foresightyj/gists{/gist_id}","starred_url":"https://api.github.com/users/foresightyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foresightyj/subscriptions","organizations_url":"https://api.github.com/users/foresightyj/orgs","repos_url":"https://api.github.com/users/foresightyj/repos","events_url":"https://api.github.com/users/foresightyj/events{/privacy}","received_events_url":"https://api.github.com/users/foresightyj/received_events","type":"User","site_admin":false},"created_at":"2017-08-24T02:39:55Z","updated_at":"2017-08-24T02:39:55Z","body":"Oh. I feel stupid after seeing your answer. I jumped to conclusion too quickly. Sorry."}}
{"actor":{"display_login":"foresightyj"}}