{"action":"created","comment":{"url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/comments/109103104","pull_request_review_id":30182332,"id":109103104,"diff_hunk":"@@ -65,9 +66,21 @@ public Action deserialize(JsonElement jsonElement, Type typeOfT, JsonDeserializa\n \n         Map.Entry<String, JsonElement> firstEntry = jsonElement.getAsJsonObject().entrySet().iterator().next();\n         JsonElement actionValue = firstEntry.getValue();\n-        Field firstField = this.actionClass.getDeclaredFields()[0];\n-        String fieldName = firstField.getName();\n+\n+        String fieldName = null;\n+\n+        if (this.actionClass.getEnclosingClass() != null &&\n+                !Modifier.isStatic(this.actionClass.getModifiers())) {\n+            //never happen, since action class was validated when registered.\n+            throw new JsonParseException(\"non static inner class is not allowed\");\n+        } else if (this.actionClass.getDeclaredFields().length == 1){\n+            fieldName = this.actionClass.getDeclaredFields()[0].getName();\n+        }","path":"thingif/src/main/java/com/kii/thingif/internal/gson/ActionAdapter.java","position":23,"original_position":23,"commit_id":"4acfa4bbdee56e2b9b6252b47e71baa37cf6677f","original_commit_id":"4acfa4bbdee56e2b9b6252b47e71baa37cf6677f","user":{"login":"shinsuke-nara","id":1961600,"avatar_url":"https://avatars0.githubusercontent.com/u/1961600?v=3","gravatar_id":"","url":"https://api.github.com/users/shinsuke-nara","html_url":"https://github.com/shinsuke-nara","followers_url":"https://api.github.com/users/shinsuke-nara/followers","following_url":"https://api.github.com/users/shinsuke-nara/following{/other_user}","gists_url":"https://api.github.com/users/shinsuke-nara/gists{/gist_id}","starred_url":"https://api.github.com/users/shinsuke-nara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shinsuke-nara/subscriptions","organizations_url":"https://api.github.com/users/shinsuke-nara/orgs","repos_url":"https://api.github.com/users/shinsuke-nara/repos","events_url":"https://api.github.com/users/shinsuke-nara/events{/privacy}","received_events_url":"https://api.github.com/users/shinsuke-nara/received_events","type":"User","site_admin":false},"body":"I prefer to check `actionClass` in constructor because if `ActionAdapter#deserialize()` is called twice, then checking action process runs twice. It is redundant.\r\n\r\nIf you prefer to check this here, I follow your decision:+1:","created_at":"2017-03-31T07:31:15Z","updated_at":"2017-03-31T07:37:33Z","html_url":"https://github.com/KiiPlatform/thing-if-AndroidSDK/pull/294#discussion_r109103104","pull_request_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/294","_links":{"self":{"href":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/comments/109103104"},"html":{"href":"https://github.com/KiiPlatform/thing-if-AndroidSDK/pull/294#discussion_r109103104"},"pull_request":{"href":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/294"}}},"pull_request":{"url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/294","id":113397983,"html_url":"https://github.com/KiiPlatform/thing-if-AndroidSDK/pull/294","diff_url":"https://github.com/KiiPlatform/thing-if-AndroidSDK/pull/294.diff","patch_url":"https://github.com/KiiPlatform/thing-if-AndroidSDK/pull/294.patch","issue_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/issues/294","number":294,"state":"open","locked":false,"title":"Improve ActionAdapter","user":{"login":"yongpingchen","id":1248696,"avatar_url":"https://avatars2.githubusercontent.com/u/1248696?v=3","gravatar_id":"","url":"https://api.github.com/users/yongpingchen","html_url":"https://github.com/yongpingchen","followers_url":"https://api.github.com/users/yongpingchen/followers","following_url":"https://api.github.com/users/yongpingchen/following{/other_user}","gists_url":"https://api.github.com/users/yongpingchen/gists{/gist_id}","starred_url":"https://api.github.com/users/yongpingchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yongpingchen/subscriptions","organizations_url":"https://api.github.com/users/yongpingchen/orgs","repos_url":"https://api.github.com/users/yongpingchen/repos","events_url":"https://api.github.com/users/yongpingchen/events{/privacy}","received_events_url":"https://api.github.com/users/yongpingchen/received_events","type":"User","site_admin":false},"body":"- Improve deserialize code when parsing inner class\r\n- Add more small tests","created_at":"2017-03-30T10:42:30Z","updated_at":"2017-03-31T07:37:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fcccbb8418908a6f007ef3fb46c29e62f54a7d98","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/294/commits","review_comments_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/294/comments","review_comment_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/comments{/number}","comments_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/issues/294/comments","statuses_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/statuses/4acfa4bbdee56e2b9b6252b47e71baa37cf6677f","head":{"label":"KiiPlatform:improve_ActionAdapter","ref":"improve_ActionAdapter","sha":"4acfa4bbdee56e2b9b6252b47e71baa37cf6677f","user":{"login":"KiiPlatform","id":3078752,"avatar_url":"https://avatars0.githubusercontent.com/u/3078752?v=3","gravatar_id":"","url":"https://api.github.com/users/KiiPlatform","html_url":"https://github.com/KiiPlatform","followers_url":"https://api.github.com/users/KiiPlatform/followers","following_url":"https://api.github.com/users/KiiPlatform/following{/other_user}","gists_url":"https://api.github.com/users/KiiPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/KiiPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KiiPlatform/subscriptions","organizations_url":"https://api.github.com/users/KiiPlatform/orgs","repos_url":"https://api.github.com/users/KiiPlatform/repos","events_url":"https://api.github.com/users/KiiPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/KiiPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":40101524,"name":"thing-if-AndroidSDK","full_name":"KiiPlatform/thing-if-AndroidSDK","owner":{"login":"KiiPlatform","id":3078752,"avatar_url":"https://avatars0.githubusercontent.com/u/3078752?v=3","gravatar_id":"","url":"https://api.github.com/users/KiiPlatform","html_url":"https://github.com/KiiPlatform","followers_url":"https://api.github.com/users/KiiPlatform/followers","following_url":"https://api.github.com/users/KiiPlatform/following{/other_user}","gists_url":"https://api.github.com/users/KiiPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/KiiPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KiiPlatform/subscriptions","organizations_url":"https://api.github.com/users/KiiPlatform/orgs","repos_url":"https://api.github.com/users/KiiPlatform/repos","events_url":"https://api.github.com/users/KiiPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/KiiPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/KiiPlatform/thing-if-AndroidSDK","description":"Android SDK for Kii Thing Interaction Framework.","fork":false,"url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK","forks_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/forks","keys_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/teams","hooks_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/hooks","issue_events_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/issues/events{/number}","events_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/events","assignees_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/assignees{/user}","branches_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/branches{/branch}","tags_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/tags","blobs_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/git/refs{/sha}","trees_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/statuses/{sha}","languages_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/languages","stargazers_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/stargazers","contributors_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/contributors","subscribers_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/subscribers","subscription_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/subscription","commits_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/commits{/sha}","git_commits_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/git/commits{/sha}","comments_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/comments{/number}","issue_comment_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/issues/comments{/number}","contents_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/contents/{+path}","compare_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/merges","archive_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/downloads","issues_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/issues{/number}","pulls_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls{/number}","milestones_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/milestones{/number}","notifications_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/labels{/name}","releases_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/releases{/id}","deployments_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/deployments","created_at":"2015-08-03T02:37:01Z","updated_at":"2017-02-10T05:01:13Z","pushed_at":"2017-03-31T07:12:53Z","git_url":"git://github.com/KiiPlatform/thing-if-AndroidSDK.git","ssh_url":"git@github.com:KiiPlatform/thing-if-AndroidSDK.git","clone_url":"https://github.com/KiiPlatform/thing-if-AndroidSDK.git","svn_url":"https://github.com/KiiPlatform/thing-if-AndroidSDK","homepage":"http://kiiplatform.github.io/thing-if-AndroidSDK/","size":2214,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":7,"forks":3,"open_issues":7,"watchers":2,"default_branch":"master"}},"base":{"label":"KiiPlatform:develop","ref":"develop","sha":"2a989c872fb02bda6166ad5dd2f3dfa9ab0061a5","user":{"login":"KiiPlatform","id":3078752,"avatar_url":"https://avatars0.githubusercontent.com/u/3078752?v=3","gravatar_id":"","url":"https://api.github.com/users/KiiPlatform","html_url":"https://github.com/KiiPlatform","followers_url":"https://api.github.com/users/KiiPlatform/followers","following_url":"https://api.github.com/users/KiiPlatform/following{/other_user}","gists_url":"https://api.github.com/users/KiiPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/KiiPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KiiPlatform/subscriptions","organizations_url":"https://api.github.com/users/KiiPlatform/orgs","repos_url":"https://api.github.com/users/KiiPlatform/repos","events_url":"https://api.github.com/users/KiiPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/KiiPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":40101524,"name":"thing-if-AndroidSDK","full_name":"KiiPlatform/thing-if-AndroidSDK","owner":{"login":"KiiPlatform","id":3078752,"avatar_url":"https://avatars0.githubusercontent.com/u/3078752?v=3","gravatar_id":"","url":"https://api.github.com/users/KiiPlatform","html_url":"https://github.com/KiiPlatform","followers_url":"https://api.github.com/users/KiiPlatform/followers","following_url":"https://api.github.com/users/KiiPlatform/following{/other_user}","gists_url":"https://api.github.com/users/KiiPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/KiiPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KiiPlatform/subscriptions","organizations_url":"https://api.github.com/users/KiiPlatform/orgs","repos_url":"https://api.github.com/users/KiiPlatform/repos","events_url":"https://api.github.com/users/KiiPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/KiiPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/KiiPlatform/thing-if-AndroidSDK","description":"Android SDK for Kii Thing Interaction Framework.","fork":false,"url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK","forks_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/forks","keys_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/teams","hooks_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/hooks","issue_events_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/issues/events{/number}","events_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/events","assignees_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/assignees{/user}","branches_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/branches{/branch}","tags_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/tags","blobs_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/git/refs{/sha}","trees_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/statuses/{sha}","languages_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/languages","stargazers_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/stargazers","contributors_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/contributors","subscribers_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/subscribers","subscription_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/subscription","commits_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/commits{/sha}","git_commits_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/git/commits{/sha}","comments_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/comments{/number}","issue_comment_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/issues/comments{/number}","contents_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/contents/{+path}","compare_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/merges","archive_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/downloads","issues_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/issues{/number}","pulls_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls{/number}","milestones_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/milestones{/number}","notifications_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/labels{/name}","releases_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/releases{/id}","deployments_url":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/deployments","created_at":"2015-08-03T02:37:01Z","updated_at":"2017-02-10T05:01:13Z","pushed_at":"2017-03-31T07:12:53Z","git_url":"git://github.com/KiiPlatform/thing-if-AndroidSDK.git","ssh_url":"git@github.com:KiiPlatform/thing-if-AndroidSDK.git","clone_url":"https://github.com/KiiPlatform/thing-if-AndroidSDK.git","svn_url":"https://github.com/KiiPlatform/thing-if-AndroidSDK","homepage":"http://kiiplatform.github.io/thing-if-AndroidSDK/","size":2214,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3,"mirror_url":null,"open_issues_count":7,"forks":3,"open_issues":7,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/294"},"html":{"href":"https://github.com/KiiPlatform/thing-if-AndroidSDK/pull/294"},"issue":{"href":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/issues/294"},"comments":{"href":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/issues/294/comments"},"review_comments":{"href":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/294/comments"},"review_comment":{"href":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/pulls/294/commits"},"statuses":{"href":"https://api.github.com/repos/KiiPlatform/thing-if-AndroidSDK/statuses/4acfa4bbdee56e2b9b6252b47e71baa37cf6677f"}}}}
{"actor":{"display_login":"shinsuke-nara"}}