{"action":"created","comment":{"url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/comments/140698208","pull_request_review_id":64803312,"id":140698208,"diff_hunk":"@@ -0,0 +1,113 @@\n+/*\n+ *\n+ * Copyright 2017 PingCAP, Inc.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *      http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ *\n+ */\n+\n+package com.pingcap.tikv.meta;\n+\n+import static java.util.Objects.requireNonNull;\n+\n+import com.google.common.collect.Range;\n+import com.google.common.primitives.UnsignedBytes;\n+import com.google.protobuf.ByteString;\n+import com.pingcap.tikv.kvproto.Coprocessor;\n+import java.util.Comparator;\n+import javax.annotation.Nonnull;\n+\n+public class TiKey<T> implements Comparable<TiKey<T>> {\n+\n+  // below might uses UnsafeComparator if possible\n+  private static final Comparator<byte[]> comparator = UnsignedBytes.lexicographicalComparator();\n+  private T data;\n+\n+  public TiKey(@Nonnull T data) {\n+    this.data = data;\n+  }\n+\n+  private int compareTo(@Nonnull ByteString o) {\n+    requireNonNull(o, \"other is null\");\n+    ByteString data = (ByteString)this.data;","path":"src/main/java/com/pingcap/tikv/meta/TiKey.java","position":41,"original_position":41,"commit_id":"363e11bca5bf69b2fdb5b27ac25d9a8a8fe660cc","original_commit_id":"363e11bca5bf69b2fdb5b27ac25d9a8a8fe660cc","user":{"login":"birdstorm","id":15857134,"avatar_url":"https://avatars1.githubusercontent.com/u/15857134?v=4","gravatar_id":"","url":"https://api.github.com/users/birdstorm","html_url":"https://github.com/birdstorm","followers_url":"https://api.github.com/users/birdstorm/followers","following_url":"https://api.github.com/users/birdstorm/following{/other_user}","gists_url":"https://api.github.com/users/birdstorm/gists{/gist_id}","starred_url":"https://api.github.com/users/birdstorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birdstorm/subscriptions","organizations_url":"https://api.github.com/users/birdstorm/orgs","repos_url":"https://api.github.com/users/birdstorm/repos","events_url":"https://api.github.com/users/birdstorm/events{/privacy}","received_events_url":"https://api.github.com/users/birdstorm/received_events","type":"User","site_admin":false},"body":"maybe we should add <instanceof> if-clause to deal with exceptions?\r\nHere we have dealt with TiKey's comparison against Comparable, ByteString and byte[], but not yet resolved cases vice versa. \r\nThe same goes following two compareTo functions.","created_at":"2017-09-25T06:41:48Z","updated_at":"2017-09-25T06:42:59Z","html_url":"https://github.com/pingcap/tikv-client-lib-java/pull/84#discussion_r140698208","pull_request_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/84","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/comments/140698208"},"html":{"href":"https://github.com/pingcap/tikv-client-lib-java/pull/84#discussion_r140698208"},"pull_request":{"href":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/84"}}},"pull_request":{"url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/84","id":133086324,"html_url":"https://github.com/pingcap/tikv-client-lib-java/pull/84","diff_url":"https://github.com/pingcap/tikv-client-lib-java/pull/84.diff","patch_url":"https://github.com/pingcap/tikv-client-lib-java/pull/84.patch","issue_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/issues/84","number":84,"state":"open","locked":false,"title":"more clean up","user":{"login":"zhexuany","id":13320708,"avatar_url":"https://avatars0.githubusercontent.com/u/13320708?v=4","gravatar_id":"","url":"https://api.github.com/users/zhexuany","html_url":"https://github.com/zhexuany","followers_url":"https://api.github.com/users/zhexuany/followers","following_url":"https://api.github.com/users/zhexuany/following{/other_user}","gists_url":"https://api.github.com/users/zhexuany/gists{/gist_id}","starred_url":"https://api.github.com/users/zhexuany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhexuany/subscriptions","organizations_url":"https://api.github.com/users/zhexuany/orgs","repos_url":"https://api.github.com/users/zhexuany/repos","events_url":"https://api.github.com/users/zhexuany/events{/privacy}","received_events_url":"https://api.github.com/users/zhexuany/received_events","type":"User","site_admin":false},"body":"adding `SupressWarning(\"unchecked\")` which can suppress `unchecked` warning in our code base.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/pingcap/tikv-client-lib-java/84)\n<!-- Reviewable:end -->\n","created_at":"2017-07-29T08:59:54Z","updated_at":"2017-09-25T06:42:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b2c6b46eeb05375640c63a78a832e5f251e4594","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/84/commits","review_comments_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/84/comments","review_comment_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/issues/84/comments","statuses_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/statuses/363e11bca5bf69b2fdb5b27ac25d9a8a8fe660cc","head":{"label":"pingcap:zhexuany/more_cleanup","ref":"zhexuany/more_cleanup","sha":"363e11bca5bf69b2fdb5b27ac25d9a8a8fe660cc","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars3.githubusercontent.com/u/11855343?v=4","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":89454597,"name":"tikv-client-lib-java","full_name":"pingcap/tikv-client-lib-java","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars3.githubusercontent.com/u/11855343?v=4","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/tikv-client-lib-java","description":"TiKV Java client library","fork":false,"url":"https://api.github.com/repos/pingcap/tikv-client-lib-java","forks_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/forks","keys_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/teams","hooks_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/hooks","issue_events_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/events","assignees_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/tags","blobs_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/languages","stargazers_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/stargazers","contributors_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/contributors","subscribers_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/subscribers","subscription_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/subscription","commits_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/merges","archive_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/downloads","issues_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/deployments","created_at":"2017-04-26T08:01:47Z","updated_at":"2017-09-13T07:06:24Z","pushed_at":"2017-09-25T05:54:46Z","git_url":"git://github.com/pingcap/tikv-client-lib-java.git","ssh_url":"git@github.com:pingcap/tikv-client-lib-java.git","clone_url":"https://github.com/pingcap/tikv-client-lib-java.git","svn_url":"https://github.com/pingcap/tikv-client-lib-java","homepage":"","size":1023,"stargazers_count":26,"watchers_count":26,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":10,"forks":12,"open_issues":10,"watchers":26,"default_branch":"master"}},"base":{"label":"pingcap:master","ref":"master","sha":"e05f9e34fb2b8fd77ca438bb21763ce0b9385b0d","user":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars3.githubusercontent.com/u/11855343?v=4","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"repo":{"id":89454597,"name":"tikv-client-lib-java","full_name":"pingcap/tikv-client-lib-java","owner":{"login":"pingcap","id":11855343,"avatar_url":"https://avatars3.githubusercontent.com/u/11855343?v=4","gravatar_id":"","url":"https://api.github.com/users/pingcap","html_url":"https://github.com/pingcap","followers_url":"https://api.github.com/users/pingcap/followers","following_url":"https://api.github.com/users/pingcap/following{/other_user}","gists_url":"https://api.github.com/users/pingcap/gists{/gist_id}","starred_url":"https://api.github.com/users/pingcap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pingcap/subscriptions","organizations_url":"https://api.github.com/users/pingcap/orgs","repos_url":"https://api.github.com/users/pingcap/repos","events_url":"https://api.github.com/users/pingcap/events{/privacy}","received_events_url":"https://api.github.com/users/pingcap/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pingcap/tikv-client-lib-java","description":"TiKV Java client library","fork":false,"url":"https://api.github.com/repos/pingcap/tikv-client-lib-java","forks_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/forks","keys_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/teams","hooks_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/hooks","issue_events_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/issues/events{/number}","events_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/events","assignees_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/assignees{/user}","branches_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/branches{/branch}","tags_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/tags","blobs_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/statuses/{sha}","languages_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/languages","stargazers_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/stargazers","contributors_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/contributors","subscribers_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/subscribers","subscription_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/subscription","commits_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/contents/{+path}","compare_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/merges","archive_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/downloads","issues_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/issues{/number}","pulls_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls{/number}","milestones_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/milestones{/number}","notifications_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/labels{/name}","releases_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/releases{/id}","deployments_url":"https://api.github.com/repos/pingcap/tikv-client-lib-java/deployments","created_at":"2017-04-26T08:01:47Z","updated_at":"2017-09-13T07:06:24Z","pushed_at":"2017-09-25T05:54:46Z","git_url":"git://github.com/pingcap/tikv-client-lib-java.git","ssh_url":"git@github.com:pingcap/tikv-client-lib-java.git","clone_url":"https://github.com/pingcap/tikv-client-lib-java.git","svn_url":"https://github.com/pingcap/tikv-client-lib-java","homepage":"","size":1023,"stargazers_count":26,"watchers_count":26,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":10,"forks":12,"open_issues":10,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/84"},"html":{"href":"https://github.com/pingcap/tikv-client-lib-java/pull/84"},"issue":{"href":"https://api.github.com/repos/pingcap/tikv-client-lib-java/issues/84"},"comments":{"href":"https://api.github.com/repos/pingcap/tikv-client-lib-java/issues/84/comments"},"review_comments":{"href":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/84/comments"},"review_comment":{"href":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pingcap/tikv-client-lib-java/pulls/84/commits"},"statuses":{"href":"https://api.github.com/repos/pingcap/tikv-client-lib-java/statuses/363e11bca5bf69b2fdb5b27ac25d9a8a8fe660cc"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"birdstorm"}}