{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-reef/pulls/comments/33001923","id":33001923,"diff_hunk":"@@ -0,0 +1,200 @@\n+package org.apache.reef.tang.implementation.java;\n+\n+import org.apache.reef.tang.ClassHierarchy;\n+import org.apache.reef.tang.annotations.NamedParameter;\n+import org.apache.reef.tang.exceptions.NameResolutionException;\n+import org.apache.reef.tang.formats.avro.*;\n+import org.apache.reef.tang.implementation.types.*;\n+import org.apache.reef.tang.types.*;\n+\n+import java.util.ArrayList;\n+import java.util.HashMap;\n+import java.util.List;\n+\n+/**\n+ * Implementation of ClassHierarchy for Avro\n+ */\n+public class AvroClassHierarchy implements ClassHierarchy {\n+  private final PackageNode namespace;\n+  private final HashMap<String, Node> lookupTable = new HashMap<>();\n+\n+  public AvroClassHierarchy(final AvroNode root) {\n+    namespace = new PackageNodeImpl();\n+    if (root.getPackageNode() == null) {\n+      throw new IllegalArgumentException(\"Expected a package node. Got: \" + root);\n+    }\n+\n+    // Register all the classes.\n+    for (final AvroNode child : root.getChildren()) {\n+      parseSubHierarchy(namespace, child);\n+    }\n+    buildLookupTable(namespace);\n+\n+    // Register the implementations\n+    for (final AvroNode child : root.getChildren()) {\n+      wireUpInheritanceRelationships(child);\n+    }\n+  }\n+\n+  /**\n+   * Build a table that maps the name to the corresponding Node recursively.\n+   */\n+  private void buildLookupTable(final Node n) {\n+    for(final Node child : n.getChildren()) {","path":"lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/java/AvroClassHierarchy.java","position":43,"original_position":43,"commit_id":"cb901a6623a085dbd85b542ca2150db35f17b375","original_commit_id":"cb901a6623a085dbd85b542ca2150db35f17b375","user":{"login":"jwang98052","id":5666504,"avatar_url":"https://avatars.githubusercontent.com/u/5666504?v=3","gravatar_id":"","url":"https://api.github.com/users/jwang98052","html_url":"https://github.com/jwang98052","followers_url":"https://api.github.com/users/jwang98052/followers","following_url":"https://api.github.com/users/jwang98052/following{/other_user}","gists_url":"https://api.github.com/users/jwang98052/gists{/gist_id}","starred_url":"https://api.github.com/users/jwang98052/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwang98052/subscriptions","organizations_url":"https://api.github.com/users/jwang98052/orgs","repos_url":"https://api.github.com/users/jwang98052/repos","events_url":"https://api.github.com/users/jwang98052/events{/privacy}","received_events_url":"https://api.github.com/users/jwang98052/received_events","type":"User","site_admin":false},"body":"space","created_at":"2015-06-23T01:16:53Z","updated_at":"2015-06-23T01:16:53Z","html_url":"https://github.com/apache/incubator-reef/pull/237#discussion_r33001923","pull_request_url":"https://api.github.com/repos/apache/incubator-reef/pulls/237","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-reef/pulls/comments/33001923"},"html":{"href":"https://github.com/apache/incubator-reef/pull/237#discussion_r33001923"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-reef/pulls/237"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-reef/pulls/237","id":38250402,"html_url":"https://github.com/apache/incubator-reef/pull/237","diff_url":"https://github.com/apache/incubator-reef/pull/237.diff","patch_url":"https://github.com/apache/incubator-reef/pull/237.patch","issue_url":"https://api.github.com/repos/apache/incubator-reef/issues/237","number":237,"state":"open","locked":false,"title":"[REEF-395] Implement ClassHierarchySerializer using Avro on the Java side","user":{"login":"yunseong","id":1748276,"avatar_url":"https://avatars.githubusercontent.com/u/1748276?v=3","gravatar_id":"","url":"https://api.github.com/users/yunseong","html_url":"https://github.com/yunseong","followers_url":"https://api.github.com/users/yunseong/followers","following_url":"https://api.github.com/users/yunseong/following{/other_user}","gists_url":"https://api.github.com/users/yunseong/gists{/gist_id}","starred_url":"https://api.github.com/users/yunseong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yunseong/subscriptions","organizations_url":"https://api.github.com/users/yunseong/orgs","repos_url":"https://api.github.com/users/yunseong/repos","events_url":"https://api.github.com/users/yunseong/events{/privacy}","received_events_url":"https://api.github.com/users/yunseong/received_events","type":"User","site_admin":false},"body":"This addressed the issue by\r\n  * Defining the avro schema for class hierarchy\r\n  * Implementing the AvroClassHierarchy\r\n  * Define ClassHierarchySerializer interface and implement an Avro version\r\n  * Replace the class hierarchy serializer for the round trip tests\r\n  * Leave TODO comments for the future issues to resolve when we revisit REEF-148\r\n  * Mark the `ProtocolBufferClassHierarchy` class as deprecated\r\n\r\np.s.\r\nThere was an additional change for the types in Avro. By default, Avro uses `CharSequence` for the string field: In the Java code, we should convert the types between `String` and `CharSequence` all the time. I could change the configuration to use `String` for the string field in the `pom.xml`. There was only one class (`org/apache/reef/io/network/naming/serialization/NamingLookupRequestCodec.java`) that is affected by this change and the conflict was resolved by changing only one type.","created_at":"2015-06-22T16:31:48Z","updated_at":"2015-06-23T01:16:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9c88d89b77f88e705bbb6c3c4ba8b12289ccbb8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-reef/pulls/237/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-reef/pulls/237/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-reef/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-reef/issues/237/comments","statuses_url":"https://api.github.com/repos/apache/incubator-reef/statuses/cb901a6623a085dbd85b542ca2150db35f17b375","head":{"label":"yunseong:REEF-395","ref":"REEF-395","sha":"cb901a6623a085dbd85b542ca2150db35f17b375","user":{"login":"yunseong","id":1748276,"avatar_url":"https://avatars.githubusercontent.com/u/1748276?v=3","gravatar_id":"","url":"https://api.github.com/users/yunseong","html_url":"https://github.com/yunseong","followers_url":"https://api.github.com/users/yunseong/followers","following_url":"https://api.github.com/users/yunseong/following{/other_user}","gists_url":"https://api.github.com/users/yunseong/gists{/gist_id}","starred_url":"https://api.github.com/users/yunseong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yunseong/subscriptions","organizations_url":"https://api.github.com/users/yunseong/orgs","repos_url":"https://api.github.com/users/yunseong/repos","events_url":"https://api.github.com/users/yunseong/events{/privacy}","received_events_url":"https://api.github.com/users/yunseong/received_events","type":"User","site_admin":false},"repo":{"id":25671255,"name":"incubator-reef","full_name":"yunseong/incubator-reef","owner":{"login":"yunseong","id":1748276,"avatar_url":"https://avatars.githubusercontent.com/u/1748276?v=3","gravatar_id":"","url":"https://api.github.com/users/yunseong","html_url":"https://github.com/yunseong","followers_url":"https://api.github.com/users/yunseong/followers","following_url":"https://api.github.com/users/yunseong/following{/other_user}","gists_url":"https://api.github.com/users/yunseong/gists{/gist_id}","starred_url":"https://api.github.com/users/yunseong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yunseong/subscriptions","organizations_url":"https://api.github.com/users/yunseong/orgs","repos_url":"https://api.github.com/users/yunseong/repos","events_url":"https://api.github.com/users/yunseong/events{/privacy}","received_events_url":"https://api.github.com/users/yunseong/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yunseong/incubator-reef","description":"Mirror of Apache REEF (Incubating)","fork":true,"url":"https://api.github.com/repos/yunseong/incubator-reef","forks_url":"https://api.github.com/repos/yunseong/incubator-reef/forks","keys_url":"https://api.github.com/repos/yunseong/incubator-reef/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yunseong/incubator-reef/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yunseong/incubator-reef/teams","hooks_url":"https://api.github.com/repos/yunseong/incubator-reef/hooks","issue_events_url":"https://api.github.com/repos/yunseong/incubator-reef/issues/events{/number}","events_url":"https://api.github.com/repos/yunseong/incubator-reef/events","assignees_url":"https://api.github.com/repos/yunseong/incubator-reef/assignees{/user}","branches_url":"https://api.github.com/repos/yunseong/incubator-reef/branches{/branch}","tags_url":"https://api.github.com/repos/yunseong/incubator-reef/tags","blobs_url":"https://api.github.com/repos/yunseong/incubator-reef/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yunseong/incubator-reef/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yunseong/incubator-reef/git/refs{/sha}","trees_url":"https://api.github.com/repos/yunseong/incubator-reef/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yunseong/incubator-reef/statuses/{sha}","languages_url":"https://api.github.com/repos/yunseong/incubator-reef/languages","stargazers_url":"https://api.github.com/repos/yunseong/incubator-reef/stargazers","contributors_url":"https://api.github.com/repos/yunseong/incubator-reef/contributors","subscribers_url":"https://api.github.com/repos/yunseong/incubator-reef/subscribers","subscription_url":"https://api.github.com/repos/yunseong/incubator-reef/subscription","commits_url":"https://api.github.com/repos/yunseong/incubator-reef/commits{/sha}","git_commits_url":"https://api.github.com/repos/yunseong/incubator-reef/git/commits{/sha}","comments_url":"https://api.github.com/repos/yunseong/incubator-reef/comments{/number}","issue_comment_url":"https://api.github.com/repos/yunseong/incubator-reef/issues/comments{/number}","contents_url":"https://api.github.com/repos/yunseong/incubator-reef/contents/{+path}","compare_url":"https://api.github.com/repos/yunseong/incubator-reef/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yunseong/incubator-reef/merges","archive_url":"https://api.github.com/repos/yunseong/incubator-reef/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yunseong/incubator-reef/downloads","issues_url":"https://api.github.com/repos/yunseong/incubator-reef/issues{/number}","pulls_url":"https://api.github.com/repos/yunseong/incubator-reef/pulls{/number}","milestones_url":"https://api.github.com/repos/yunseong/incubator-reef/milestones{/number}","notifications_url":"https://api.github.com/repos/yunseong/incubator-reef/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yunseong/incubator-reef/labels{/name}","releases_url":"https://api.github.com/repos/yunseong/incubator-reef/releases{/id}","created_at":"2014-10-24T04:14:51Z","updated_at":"2014-10-23T15:08:44Z","pushed_at":"2015-06-22T16:04:29Z","git_url":"git://github.com/yunseong/incubator-reef.git","ssh_url":"git@github.com:yunseong/incubator-reef.git","clone_url":"https://github.com/yunseong/incubator-reef.git","svn_url":"https://github.com/yunseong/incubator-reef","homepage":null,"size":28073,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"2b374dfa51856dc2c29928f889f8358a7877044b","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":25623941,"name":"incubator-reef","full_name":"apache/incubator-reef","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/incubator-reef","description":"Mirror of Apache REEF (Incubating)","fork":false,"url":"https://api.github.com/repos/apache/incubator-reef","forks_url":"https://api.github.com/repos/apache/incubator-reef/forks","keys_url":"https://api.github.com/repos/apache/incubator-reef/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-reef/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-reef/teams","hooks_url":"https://api.github.com/repos/apache/incubator-reef/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-reef/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-reef/events","assignees_url":"https://api.github.com/repos/apache/incubator-reef/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-reef/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-reef/tags","blobs_url":"https://api.github.com/repos/apache/incubator-reef/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-reef/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-reef/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-reef/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-reef/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-reef/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-reef/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-reef/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-reef/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-reef/subscription","commits_url":"https://api.github.com/repos/apache/incubator-reef/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-reef/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-reef/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-reef/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-reef/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-reef/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-reef/merges","archive_url":"https://api.github.com/repos/apache/incubator-reef/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-reef/downloads","issues_url":"https://api.github.com/repos/apache/incubator-reef/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-reef/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-reef/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-reef/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-reef/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-reef/releases{/id}","created_at":"2014-10-23T07:00:10Z","updated_at":"2015-06-17T02:46:19Z","pushed_at":"2015-06-22T23:22:23Z","git_url":"git://github.com/apache/incubator-reef.git","ssh_url":"git@github.com:apache/incubator-reef.git","clone_url":"https://github.com/apache/incubator-reef.git","svn_url":"https://github.com/apache/incubator-reef","homepage":null,"size":40670,"stargazers_count":22,"watchers_count":22,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":25,"mirror_url":"git://git.apache.org/incubator-reef.git","open_issues_count":5,"forks":25,"open_issues":5,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-reef/pulls/237"},"html":{"href":"https://github.com/apache/incubator-reef/pull/237"},"issue":{"href":"https://api.github.com/repos/apache/incubator-reef/issues/237"},"comments":{"href":"https://api.github.com/repos/apache/incubator-reef/issues/237/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-reef/pulls/237/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-reef/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-reef/pulls/237/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-reef/statuses/cb901a6623a085dbd85b542ca2150db35f17b375"}}}}