{"action":"created","comment":{"url":"https://api.github.com/repos/yarpc/yarpc-java/pulls/comments/53426640","id":53426640,"diff_hunk":"@@ -0,0 +1,44 @@\n+/**\n+ * Copyright (c) 2016, Uber Technologies, Inc\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in\n+ * all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ * THE SOFTWARE.\n+ */\n+package io.yarpc.encoding.thrift;\n+\n+import io.yarpc.encoding.Serializer;\n+import org.apache.thrift.TBase;\n+import org.apache.thrift.TDeserializer;\n+import org.apache.thrift.TSerializer;\n+import org.apache.thrift.protocol.TBinaryProtocol;\n+\n+public class ThriftSerializer implements Serializer {\n+    public <T> byte[] marshal(T value) throws Exception {\n+        TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());\n+        return serializer.serialize((TBase) value);\n+    }\n+\n+    public <T> T unmarshal(byte[] value, Class<? extends T> clazz) throws Exception {\n+        T base = clazz.newInstance();\n+\n+        TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());\n+        deserializer.deserialize((TBase) base, value);","path":"yarpc-core/src/main/java/io/yarpc/encoding/thrift/ThriftSerializer.java","position":40,"original_position":40,"commit_id":"95d3414029bc62e645a10b935ad7c122737380a3","original_commit_id":"95d3414029bc62e645a10b935ad7c122737380a3","user":{"login":"prashantv","id":140159,"avatar_url":"https://avatars.githubusercontent.com/u/140159?v=3","gravatar_id":"","url":"https://api.github.com/users/prashantv","html_url":"https://github.com/prashantv","followers_url":"https://api.github.com/users/prashantv/followers","following_url":"https://api.github.com/users/prashantv/following{/other_user}","gists_url":"https://api.github.com/users/prashantv/gists{/gist_id}","starred_url":"https://api.github.com/users/prashantv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prashantv/subscriptions","organizations_url":"https://api.github.com/users/prashantv/orgs","repos_url":"https://api.github.com/users/prashantv/repos","events_url":"https://api.github.com/users/prashantv/events{/privacy}","received_events_url":"https://api.github.com/users/prashantv/received_events","type":"User","site_admin":false},"body":"can't you do `<T extends TBase>` so that you don't need casts here and above?","created_at":"2016-02-19T06:21:01Z","updated_at":"2016-02-19T06:21:01Z","html_url":"https://github.com/yarpc/yarpc-java/pull/22#discussion_r53426640","pull_request_url":"https://api.github.com/repos/yarpc/yarpc-java/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/yarpc/yarpc-java/pulls/comments/53426640"},"html":{"href":"https://github.com/yarpc/yarpc-java/pull/22#discussion_r53426640"},"pull_request":{"href":"https://api.github.com/repos/yarpc/yarpc-java/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/yarpc/yarpc-java/pulls/22","id":59739077,"html_url":"https://github.com/yarpc/yarpc-java/pull/22","diff_url":"https://github.com/yarpc/yarpc-java/pull/22.diff","patch_url":"https://github.com/yarpc/yarpc-java/pull/22.patch","issue_url":"https://api.github.com/repos/yarpc/yarpc-java/issues/22","number":22,"state":"open","locked":false,"title":"Thrift encoding","user":{"login":"junchaowu","id":3731781,"avatar_url":"https://avatars.githubusercontent.com/u/3731781?v=3","gravatar_id":"","url":"https://api.github.com/users/junchaowu","html_url":"https://github.com/junchaowu","followers_url":"https://api.github.com/users/junchaowu/followers","following_url":"https://api.github.com/users/junchaowu/following{/other_user}","gists_url":"https://api.github.com/users/junchaowu/gists{/gist_id}","starred_url":"https://api.github.com/users/junchaowu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/junchaowu/subscriptions","organizations_url":"https://api.github.com/users/junchaowu/orgs","repos_url":"https://api.github.com/users/junchaowu/repos","events_url":"https://api.github.com/users/junchaowu/events{/privacy}","received_events_url":"https://api.github.com/users/junchaowu/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-18T01:46:50Z","updated_at":"2016-02-19T06:21:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5daf252d87c9d0bbeab94dbda39d861364241e4a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yarpc/yarpc-java/pulls/22/commits","review_comments_url":"https://api.github.com/repos/yarpc/yarpc-java/pulls/22/comments","review_comment_url":"https://api.github.com/repos/yarpc/yarpc-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yarpc/yarpc-java/issues/22/comments","statuses_url":"https://api.github.com/repos/yarpc/yarpc-java/statuses/95d3414029bc62e645a10b935ad7c122737380a3","head":{"label":"yarpc:fullthrift","ref":"fullthrift","sha":"95d3414029bc62e645a10b935ad7c122737380a3","user":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"repo":{"id":50390107,"name":"yarpc-java","full_name":"yarpc/yarpc-java","owner":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yarpc/yarpc-java","description":"YARPC for Java","fork":false,"url":"https://api.github.com/repos/yarpc/yarpc-java","forks_url":"https://api.github.com/repos/yarpc/yarpc-java/forks","keys_url":"https://api.github.com/repos/yarpc/yarpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarpc/yarpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarpc/yarpc-java/teams","hooks_url":"https://api.github.com/repos/yarpc/yarpc-java/hooks","issue_events_url":"https://api.github.com/repos/yarpc/yarpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/yarpc/yarpc-java/events","assignees_url":"https://api.github.com/repos/yarpc/yarpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/yarpc/yarpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/yarpc/yarpc-java/tags","blobs_url":"https://api.github.com/repos/yarpc/yarpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarpc/yarpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarpc/yarpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarpc/yarpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarpc/yarpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/yarpc/yarpc-java/languages","stargazers_url":"https://api.github.com/repos/yarpc/yarpc-java/stargazers","contributors_url":"https://api.github.com/repos/yarpc/yarpc-java/contributors","subscribers_url":"https://api.github.com/repos/yarpc/yarpc-java/subscribers","subscription_url":"https://api.github.com/repos/yarpc/yarpc-java/subscription","commits_url":"https://api.github.com/repos/yarpc/yarpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarpc/yarpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarpc/yarpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarpc/yarpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarpc/yarpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/yarpc/yarpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarpc/yarpc-java/merges","archive_url":"https://api.github.com/repos/yarpc/yarpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarpc/yarpc-java/downloads","issues_url":"https://api.github.com/repos/yarpc/yarpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/yarpc/yarpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/yarpc/yarpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/yarpc/yarpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarpc/yarpc-java/labels{/name}","releases_url":"https://api.github.com/repos/yarpc/yarpc-java/releases{/id}","deployments_url":"https://api.github.com/repos/yarpc/yarpc-java/deployments","created_at":"2016-01-26T00:04:00Z","updated_at":"2016-02-01T22:46:28Z","pushed_at":"2016-02-18T23:24:17Z","git_url":"git://github.com/yarpc/yarpc-java.git","ssh_url":"git@github.com:yarpc/yarpc-java.git","clone_url":"https://github.com/yarpc/yarpc-java.git","svn_url":"https://github.com/yarpc/yarpc-java","homepage":"","size":88,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":1,"default_branch":"master"}},"base":{"label":"yarpc:master","ref":"master","sha":"c19b09c53a86a414555c1e2161962231ed06451c","user":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"repo":{"id":50390107,"name":"yarpc-java","full_name":"yarpc/yarpc-java","owner":{"login":"yarpc","id":16569504,"avatar_url":"https://avatars.githubusercontent.com/u/16569504?v=3","gravatar_id":"","url":"https://api.github.com/users/yarpc","html_url":"https://github.com/yarpc","followers_url":"https://api.github.com/users/yarpc/followers","following_url":"https://api.github.com/users/yarpc/following{/other_user}","gists_url":"https://api.github.com/users/yarpc/gists{/gist_id}","starred_url":"https://api.github.com/users/yarpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarpc/subscriptions","organizations_url":"https://api.github.com/users/yarpc/orgs","repos_url":"https://api.github.com/users/yarpc/repos","events_url":"https://api.github.com/users/yarpc/events{/privacy}","received_events_url":"https://api.github.com/users/yarpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yarpc/yarpc-java","description":"YARPC for Java","fork":false,"url":"https://api.github.com/repos/yarpc/yarpc-java","forks_url":"https://api.github.com/repos/yarpc/yarpc-java/forks","keys_url":"https://api.github.com/repos/yarpc/yarpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarpc/yarpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarpc/yarpc-java/teams","hooks_url":"https://api.github.com/repos/yarpc/yarpc-java/hooks","issue_events_url":"https://api.github.com/repos/yarpc/yarpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/yarpc/yarpc-java/events","assignees_url":"https://api.github.com/repos/yarpc/yarpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/yarpc/yarpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/yarpc/yarpc-java/tags","blobs_url":"https://api.github.com/repos/yarpc/yarpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarpc/yarpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarpc/yarpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarpc/yarpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarpc/yarpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/yarpc/yarpc-java/languages","stargazers_url":"https://api.github.com/repos/yarpc/yarpc-java/stargazers","contributors_url":"https://api.github.com/repos/yarpc/yarpc-java/contributors","subscribers_url":"https://api.github.com/repos/yarpc/yarpc-java/subscribers","subscription_url":"https://api.github.com/repos/yarpc/yarpc-java/subscription","commits_url":"https://api.github.com/repos/yarpc/yarpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarpc/yarpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarpc/yarpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarpc/yarpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarpc/yarpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/yarpc/yarpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarpc/yarpc-java/merges","archive_url":"https://api.github.com/repos/yarpc/yarpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarpc/yarpc-java/downloads","issues_url":"https://api.github.com/repos/yarpc/yarpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/yarpc/yarpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/yarpc/yarpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/yarpc/yarpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarpc/yarpc-java/labels{/name}","releases_url":"https://api.github.com/repos/yarpc/yarpc-java/releases{/id}","deployments_url":"https://api.github.com/repos/yarpc/yarpc-java/deployments","created_at":"2016-01-26T00:04:00Z","updated_at":"2016-02-01T22:46:28Z","pushed_at":"2016-02-18T23:24:17Z","git_url":"git://github.com/yarpc/yarpc-java.git","ssh_url":"git@github.com:yarpc/yarpc-java.git","clone_url":"https://github.com/yarpc/yarpc-java.git","svn_url":"https://github.com/yarpc/yarpc-java","homepage":"","size":88,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yarpc/yarpc-java/pulls/22"},"html":{"href":"https://github.com/yarpc/yarpc-java/pull/22"},"issue":{"href":"https://api.github.com/repos/yarpc/yarpc-java/issues/22"},"comments":{"href":"https://api.github.com/repos/yarpc/yarpc-java/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/yarpc/yarpc-java/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/yarpc/yarpc-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yarpc/yarpc-java/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/yarpc/yarpc-java/statuses/95d3414029bc62e645a10b935ad7c122737380a3"}}}}