{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/57177221","id":57177221,"diff_hunk":"@@ -38,14 +43,20 @@\n      */\n     void writeTo(StreamOutput out) throws IOException;\n \n-     @FunctionalInterface\n-     interface IOFunction<T, R> {\n-         /**\n-          * Applies this function to the given argument.\n-          *\n-          * @param t the function argument\n-          * @return the function result\n-          */\n-         R apply(T t) throws IOException;\n-     }\n+    @Override\n+    default T readFrom(StreamInput in) throws IOException {\n+        // See class javadoc for reasoning\n+        throw new UnsupportedOperationException(\"Prefer calling a constructor that takes a StreamInput to calling readFrom.\");\n+    }\n+\n+    @FunctionalInterface\n+    interface Reader<R> {\n+        /**\n+         * Applies this function to the given argument.\n+         *\n+         * @param t the function argument\n+         * @return the function result\n+         */","path":"core/src/main/java/org/elasticsearch/common/io/stream/Writeable.java","position":39,"original_position":39,"commit_id":"6ecee1f6f5195bd9174770973049dcefd1aa5a65","original_commit_id":"6ecee1f6f5195bd9174770973049dcefd1aa5a65","user":{"login":"nik9000","id":215970,"avatar_url":"https://avatars.githubusercontent.com/u/215970?v=3","gravatar_id":"","url":"https://api.github.com/users/nik9000","html_url":"https://github.com/nik9000","followers_url":"https://api.github.com/users/nik9000/followers","following_url":"https://api.github.com/users/nik9000/following{/other_user}","gists_url":"https://api.github.com/users/nik9000/gists{/gist_id}","starred_url":"https://api.github.com/users/nik9000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nik9000/subscriptions","organizations_url":"https://api.github.com/users/nik9000/orgs","repos_url":"https://api.github.com/users/nik9000/repos","events_url":"https://api.github.com/users/nik9000/events{/privacy}","received_events_url":"https://api.github.com/users/nik9000/received_events","type":"User","site_admin":false},"body":"I think so. It is a leftover. Let me rewrite it.","created_at":"2016-03-23T15:18:19Z","updated_at":"2016-03-23T15:18:19Z","html_url":"https://github.com/elastic/elasticsearch/pull/17284#discussion_r57177221","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17284","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/57177221"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/17284#discussion_r57177221"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17284"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17284","id":63890622,"html_url":"https://github.com/elastic/elasticsearch/pull/17284","diff_url":"https://github.com/elastic/elasticsearch/pull/17284.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/17284.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/17284","number":17284,"state":"open","locked":false,"title":"Stop using PROTOTYPE in NamedWriteableRegistry","user":{"login":"nik9000","id":215970,"avatar_url":"https://avatars.githubusercontent.com/u/215970?v=3","gravatar_id":"","url":"https://api.github.com/users/nik9000","html_url":"https://github.com/nik9000","followers_url":"https://api.github.com/users/nik9000/followers","following_url":"https://api.github.com/users/nik9000/following{/other_user}","gists_url":"https://api.github.com/users/nik9000/gists{/gist_id}","starred_url":"https://api.github.com/users/nik9000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nik9000/subscriptions","organizations_url":"https://api.github.com/users/nik9000/orgs","repos_url":"https://api.github.com/users/nik9000/repos","events_url":"https://api.github.com/users/nik9000/events{/privacy}","received_events_url":"https://api.github.com/users/nik9000/received_events","type":"User","site_admin":false},"body":"readFrom is confusing because it requires an instance of the type that it\r\nis reading but it doesn't modify it. But we also have (deprecated) methods\r\nnamed readFrom that *do* modify the instance. The \"right\" way to implement\r\nthe non-modifying readFrom is to delegate to a constructor that takes a\r\nStreamInput so that the read object can be immutable. Now that we have\r\n`@FunctionalInterface`s it is fairly easy to register things by referring\r\ndirectly to the constructor.\r\n\r\nThis change modifying NamedWriteableRegistry so that it does that. It keeps\r\nsupporting `registerPrototype` which registers objects to be read by\r\nreadFrom but deprecates it and delegates it to a new `register` method\r\nthat allows passing a simple functional interface. It also cuts Task.Status\r\nsubclasses over to using that method.\r\n\r\nThe start of #17085\r\n","created_at":"2016-03-23T14:30:14Z","updated_at":"2016-03-23T15:18:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8875777ed5126ee7c1a51dae7744abeedf88f98e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17284/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/17284/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/17284/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/6ecee1f6f5195bd9174770973049dcefd1aa5a65","head":{"label":"nik9000:task_status_no_prototype","ref":"task_status_no_prototype","sha":"6ecee1f6f5195bd9174770973049dcefd1aa5a65","user":{"login":"nik9000","id":215970,"avatar_url":"https://avatars.githubusercontent.com/u/215970?v=3","gravatar_id":"","url":"https://api.github.com/users/nik9000","html_url":"https://github.com/nik9000","followers_url":"https://api.github.com/users/nik9000/followers","following_url":"https://api.github.com/users/nik9000/following{/other_user}","gists_url":"https://api.github.com/users/nik9000/gists{/gist_id}","starred_url":"https://api.github.com/users/nik9000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nik9000/subscriptions","organizations_url":"https://api.github.com/users/nik9000/orgs","repos_url":"https://api.github.com/users/nik9000/repos","events_url":"https://api.github.com/users/nik9000/events{/privacy}","received_events_url":"https://api.github.com/users/nik9000/received_events","type":"User","site_admin":false},"repo":{"id":11487195,"name":"elasticsearch","full_name":"nik9000/elasticsearch","owner":{"login":"nik9000","id":215970,"avatar_url":"https://avatars.githubusercontent.com/u/215970?v=3","gravatar_id":"","url":"https://api.github.com/users/nik9000","html_url":"https://github.com/nik9000","followers_url":"https://api.github.com/users/nik9000/followers","following_url":"https://api.github.com/users/nik9000/following{/other_user}","gists_url":"https://api.github.com/users/nik9000/gists{/gist_id}","starred_url":"https://api.github.com/users/nik9000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nik9000/subscriptions","organizations_url":"https://api.github.com/users/nik9000/orgs","repos_url":"https://api.github.com/users/nik9000/repos","events_url":"https://api.github.com/users/nik9000/events{/privacy}","received_events_url":"https://api.github.com/users/nik9000/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nik9000/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/nik9000/elasticsearch","forks_url":"https://api.github.com/repos/nik9000/elasticsearch/forks","keys_url":"https://api.github.com/repos/nik9000/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nik9000/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nik9000/elasticsearch/teams","hooks_url":"https://api.github.com/repos/nik9000/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/nik9000/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/nik9000/elasticsearch/events","assignees_url":"https://api.github.com/repos/nik9000/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/nik9000/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/nik9000/elasticsearch/tags","blobs_url":"https://api.github.com/repos/nik9000/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nik9000/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nik9000/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/nik9000/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nik9000/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/nik9000/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/nik9000/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/nik9000/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/nik9000/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/nik9000/elasticsearch/subscription","commits_url":"https://api.github.com/repos/nik9000/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/nik9000/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/nik9000/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/nik9000/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/nik9000/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/nik9000/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nik9000/elasticsearch/merges","archive_url":"https://api.github.com/repos/nik9000/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nik9000/elasticsearch/downloads","issues_url":"https://api.github.com/repos/nik9000/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/nik9000/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/nik9000/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/nik9000/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nik9000/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/nik9000/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/nik9000/elasticsearch/deployments","created_at":"2013-07-17T20:48:13Z","updated_at":"2014-12-15T18:37:06Z","pushed_at":"2016-03-23T14:29:02Z","git_url":"git://github.com/nik9000/elasticsearch.git","ssh_url":"git@github.com:nik9000/elasticsearch.git","clone_url":"https://github.com/nik9000/elasticsearch.git","svn_url":"https://github.com/nik9000/elasticsearch","homepage":"http://elasticsearch.org","size":195617,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"elastic:master","ref":"master","sha":"940fc3f86457f725c1f5a103c00c94a9e800323f","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":507775,"name":"elasticsearch","full_name":"elastic/elasticsearch","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":false,"url":"https://api.github.com/repos/elastic/elasticsearch","forks_url":"https://api.github.com/repos/elastic/elasticsearch/forks","keys_url":"https://api.github.com/repos/elastic/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/elasticsearch/teams","hooks_url":"https://api.github.com/repos/elastic/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/elasticsearch/events","assignees_url":"https://api.github.com/repos/elastic/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/elasticsearch/tags","blobs_url":"https://api.github.com/repos/elastic/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/elastic/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/elastic/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/elastic/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/elastic/elasticsearch/subscription","commits_url":"https://api.github.com/repos/elastic/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/elasticsearch/merges","archive_url":"https://api.github.com/repos/elastic/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/elasticsearch/downloads","issues_url":"https://api.github.com/repos/elastic/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/elastic/elasticsearch/releases{/id}","deployments_url":"https://api.github.com/repos/elastic/elasticsearch/deployments","created_at":"2010-02-08T13:20:56Z","updated_at":"2016-03-23T14:49:34Z","pushed_at":"2016-03-23T15:14:13Z","git_url":"git://github.com/elastic/elasticsearch.git","ssh_url":"git@github.com:elastic/elasticsearch.git","clone_url":"https://github.com/elastic/elasticsearch.git","svn_url":"https://github.com/elastic/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":297933,"stargazers_count":15661,"watchers_count":15661,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5229,"mirror_url":null,"open_issues_count":1066,"forks":5229,"open_issues":1066,"watchers":15661,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17284"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/17284"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/17284"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/17284/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17284/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/17284/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/6ecee1f6f5195bd9174770973049dcefd1aa5a65"}}}}