{"action":"created","comment":{"url":"https://api.github.com/repos/scala/scala/pulls/comments/206824462","pull_request_review_id":142309691,"id":206824462,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNjgyNDQ2Mg==","diff_hunk":"@@ -0,0 +1,286 @@\n+package scala.util.control\n+\n+import java.util.concurrent.atomic.AtomicBoolean\n+\n+import scala.util.Try\n+\n+/** A utility for performing automatic resource management. It can be used to perform an\n+  * operation using resources, after which it will close the resources, in reverse order\n+  * of their creation. The resource opening, operation, and resource closing are wrapped\n+  * in a `Try`.\n+  *\n+  * If more than one exception is thrown by the operation and closing resources,\n+  * the exception thrown ''first'' is returned within the `Try`, with the other exceptions\n+  * [[java.lang.Throwable.addSuppressed(Throwable) added as suppressed exceptions]]\n+  * to the one thrown first. This is the case ''unless'' a later exception is\n+  * [[scala.util.control.NonFatal fatal]], and the one preceding it is not. In that case,\n+  * the first exception is added as a suppressed exception to the fatal one, and the fatal\n+  * one is thrown. If an exception is a\n+  * [[scala.util.control.ControlThrowable ControlThrowable]], no exception will be added to\n+  * it as a suppressed exception.\n+  *\n+  * @example\n+  * {{{\n+  * val lines: Try[List[String]] = Using(resource1) { r1 =>\n+  *   r1.lines.toList\n+  * }\n+  * }}}\n+  *\n+  * @example\n+  * {{{\n+  * val lines: Try[Seq[String]] = for {\n+  *   r1 <- Using(resource1)\n+  *   r2 <- Using(resource2)\n+  *   r3 <- Using(resource3)\n+  *   r4 <- Using(resource4)\n+  * } yield {\n+  *   // use your resources here\n+  *   r1.lines ++ r2.lines ++ r3.lines ++ r4.lines\n+  * }\n+  * }}}\n+  */\n+final class Using[R](resource: => R) {\n+  private[this] val used = new AtomicBoolean(false)\n+\n+  /** Performs an operation using a resource, and then closes the resource,\n+    * even if the operation throws an exception.\n+    *\n+    * @param f the operation to perform\n+    * @param r an implicit [[Using.Resource]]\n+    * @tparam A the return type of the operation\n+    * @throws java.lang.IllegalStateException if the resource has already been used","path":"src/library/scala/util/Using.scala","position":51,"original_position":51,"commit_id":"97f2a857f4af03d20d0aa8649f9ff0d0e84bc0e2","original_commit_id":"19d5adf01de527434adb50439aa5e81856b1b471","user":{"login":"kmizu","id":97326,"node_id":"MDQ6VXNlcjk3MzI2","avatar_url":"https://avatars2.githubusercontent.com/u/97326?v=4","gravatar_id":"","url":"https://api.github.com/users/kmizu","html_url":"https://github.com/kmizu","followers_url":"https://api.github.com/users/kmizu/followers","following_url":"https://api.github.com/users/kmizu/following{/other_user}","gists_url":"https://api.github.com/users/kmizu/gists{/gist_id}","starred_url":"https://api.github.com/users/kmizu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmizu/subscriptions","organizations_url":"https://api.github.com/users/kmizu/orgs","repos_url":"https://api.github.com/users/kmizu/repos","events_url":"https://api.github.com/users/kmizu/events{/privacy}","received_events_url":"https://api.github.com/users/kmizu/received_events","type":"User","site_admin":false},"body":"@NthPortal  Sorry. I forgot to review.","created_at":"2018-08-01T10:11:04Z","updated_at":"2018-08-01T10:11:05Z","html_url":"https://github.com/scala/scala/pull/6907#discussion_r206824462","pull_request_url":"https://api.github.com/repos/scala/scala/pulls/6907","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/scala/scala/pulls/comments/206824462"},"html":{"href":"https://github.com/scala/scala/pull/6907#discussion_r206824462"},"pull_request":{"href":"https://api.github.com/repos/scala/scala/pulls/6907"}},"in_reply_to_id":205668409},"pull_request":{"url":"https://api.github.com/repos/scala/scala/pulls/6907","id":199990409,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5OTkwNDA5","html_url":"https://github.com/scala/scala/pull/6907","diff_url":"https://github.com/scala/scala/pull/6907.diff","patch_url":"https://github.com/scala/scala/pull/6907.patch","issue_url":"https://api.github.com/repos/scala/scala/issues/6907","number":6907,"state":"open","locked":false,"title":"Add utility for automatic resource management","user":{"login":"NthPortal","id":7505383,"node_id":"MDQ6VXNlcjc1MDUzODM=","avatar_url":"https://avatars0.githubusercontent.com/u/7505383?v=4","gravatar_id":"","url":"https://api.github.com/users/NthPortal","html_url":"https://github.com/NthPortal","followers_url":"https://api.github.com/users/NthPortal/followers","following_url":"https://api.github.com/users/NthPortal/following{/other_user}","gists_url":"https://api.github.com/users/NthPortal/gists{/gist_id}","starred_url":"https://api.github.com/users/NthPortal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NthPortal/subscriptions","organizations_url":"https://api.github.com/users/NthPortal/orgs","repos_url":"https://api.github.com/users/NthPortal/repos","events_url":"https://api.github.com/users/NthPortal/events{/privacy}","received_events_url":"https://api.github.com/users/NthPortal/received_events","type":"User","site_admin":false},"body":"Resolves scala/bug#11003\r\nResolves scala/bug#8028 (I think)\r\n(and possibly others)","created_at":"2018-07-09T04:44:04Z","updated_at":"2018-08-01T10:11:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2655d500253e9c4ccd0b622ef78a6b5126143a04","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":{"url":"https://api.github.com/repos/scala/scala/milestones/74","html_url":"https://github.com/scala/scala/milestone/74","labels_url":"https://api.github.com/repos/scala/scala/milestones/74/labels","id":3295287,"node_id":"MDk6TWlsZXN0b25lMzI5NTI4Nw==","number":74,"title":"2.13.0-M5","description":"Merge to 2.13.x. Last milestone (feature-frozen; aka RC0).\r\nRelease lead: @SethTisue","creator":{"login":"lrytz","id":119636,"node_id":"MDQ6VXNlcjExOTYzNg==","avatar_url":"https://avatars1.githubusercontent.com/u/119636?v=4","gravatar_id":"","url":"https://api.github.com/users/lrytz","html_url":"https://github.com/lrytz","followers_url":"https://api.github.com/users/lrytz/followers","following_url":"https://api.github.com/users/lrytz/following{/other_user}","gists_url":"https://api.github.com/users/lrytz/gists{/gist_id}","starred_url":"https://api.github.com/users/lrytz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lrytz/subscriptions","organizations_url":"https://api.github.com/users/lrytz/orgs","repos_url":"https://api.github.com/users/lrytz/repos","events_url":"https://api.github.com/users/lrytz/events{/privacy}","received_events_url":"https://api.github.com/users/lrytz/received_events","type":"User","site_admin":false},"open_issues":91,"closed_issues":303,"state":"open","created_at":"2018-04-25T07:15:17Z","updated_at":"2018-08-01T06:18:36Z","due_on":"2018-08-10T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scala/scala/pulls/6907/commits","review_comments_url":"https://api.github.com/repos/scala/scala/pulls/6907/comments","review_comment_url":"https://api.github.com/repos/scala/scala/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scala/scala/issues/6907/comments","statuses_url":"https://api.github.com/repos/scala/scala/statuses/97f2a857f4af03d20d0aa8649f9ff0d0e84bc0e2","head":{"label":"NthPortal:bug#11003/PR","ref":"bug#11003/PR","sha":"97f2a857f4af03d20d0aa8649f9ff0d0e84bc0e2","user":{"login":"NthPortal","id":7505383,"node_id":"MDQ6VXNlcjc1MDUzODM=","avatar_url":"https://avatars0.githubusercontent.com/u/7505383?v=4","gravatar_id":"","url":"https://api.github.com/users/NthPortal","html_url":"https://github.com/NthPortal","followers_url":"https://api.github.com/users/NthPortal/followers","following_url":"https://api.github.com/users/NthPortal/following{/other_user}","gists_url":"https://api.github.com/users/NthPortal/gists{/gist_id}","starred_url":"https://api.github.com/users/NthPortal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NthPortal/subscriptions","organizations_url":"https://api.github.com/users/NthPortal/orgs","repos_url":"https://api.github.com/users/NthPortal/repos","events_url":"https://api.github.com/users/NthPortal/events{/privacy}","received_events_url":"https://api.github.com/users/NthPortal/received_events","type":"User","site_admin":false},"repo":{"id":85460181,"node_id":"MDEwOlJlcG9zaXRvcnk4NTQ2MDE4MQ==","name":"scala","full_name":"NthPortal/scala","owner":{"login":"NthPortal","id":7505383,"node_id":"MDQ6VXNlcjc1MDUzODM=","avatar_url":"https://avatars0.githubusercontent.com/u/7505383?v=4","gravatar_id":"","url":"https://api.github.com/users/NthPortal","html_url":"https://github.com/NthPortal","followers_url":"https://api.github.com/users/NthPortal/followers","following_url":"https://api.github.com/users/NthPortal/following{/other_user}","gists_url":"https://api.github.com/users/NthPortal/gists{/gist_id}","starred_url":"https://api.github.com/users/NthPortal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NthPortal/subscriptions","organizations_url":"https://api.github.com/users/NthPortal/orgs","repos_url":"https://api.github.com/users/NthPortal/repos","events_url":"https://api.github.com/users/NthPortal/events{/privacy}","received_events_url":"https://api.github.com/users/NthPortal/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NthPortal/scala","description":"The Scala programming language","fork":true,"url":"https://api.github.com/repos/NthPortal/scala","forks_url":"https://api.github.com/repos/NthPortal/scala/forks","keys_url":"https://api.github.com/repos/NthPortal/scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NthPortal/scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NthPortal/scala/teams","hooks_url":"https://api.github.com/repos/NthPortal/scala/hooks","issue_events_url":"https://api.github.com/repos/NthPortal/scala/issues/events{/number}","events_url":"https://api.github.com/repos/NthPortal/scala/events","assignees_url":"https://api.github.com/repos/NthPortal/scala/assignees{/user}","branches_url":"https://api.github.com/repos/NthPortal/scala/branches{/branch}","tags_url":"https://api.github.com/repos/NthPortal/scala/tags","blobs_url":"https://api.github.com/repos/NthPortal/scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NthPortal/scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NthPortal/scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/NthPortal/scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NthPortal/scala/statuses/{sha}","languages_url":"https://api.github.com/repos/NthPortal/scala/languages","stargazers_url":"https://api.github.com/repos/NthPortal/scala/stargazers","contributors_url":"https://api.github.com/repos/NthPortal/scala/contributors","subscribers_url":"https://api.github.com/repos/NthPortal/scala/subscribers","subscription_url":"https://api.github.com/repos/NthPortal/scala/subscription","commits_url":"https://api.github.com/repos/NthPortal/scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/NthPortal/scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/NthPortal/scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/NthPortal/scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/NthPortal/scala/contents/{+path}","compare_url":"https://api.github.com/repos/NthPortal/scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NthPortal/scala/merges","archive_url":"https://api.github.com/repos/NthPortal/scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NthPortal/scala/downloads","issues_url":"https://api.github.com/repos/NthPortal/scala/issues{/number}","pulls_url":"https://api.github.com/repos/NthPortal/scala/pulls{/number}","milestones_url":"https://api.github.com/repos/NthPortal/scala/milestones{/number}","notifications_url":"https://api.github.com/repos/NthPortal/scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NthPortal/scala/labels{/name}","releases_url":"https://api.github.com/repos/NthPortal/scala/releases{/id}","deployments_url":"https://api.github.com/repos/NthPortal/scala/deployments","created_at":"2017-03-19T08:05:23Z","updated_at":"2018-07-27T20:00:57Z","pushed_at":"2018-07-27T20:00:55Z","git_url":"git://github.com/NthPortal/scala.git","ssh_url":"git@github.com:NthPortal/scala.git","clone_url":"https://github.com/NthPortal/scala.git","svn_url":"https://github.com/NthPortal/scala","homepage":"http://www.scala-lang.org/","size":100185,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"2.13.x"}},"base":{"label":"scala:2.13.x","ref":"2.13.x","sha":"dbf9a6a631e5bc56e0998fc05ddeec0b67535473","user":{"login":"scala","id":57059,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3MDU5","avatar_url":"https://avatars2.githubusercontent.com/u/57059?v=4","gravatar_id":"","url":"https://api.github.com/users/scala","html_url":"https://github.com/scala","followers_url":"https://api.github.com/users/scala/followers","following_url":"https://api.github.com/users/scala/following{/other_user}","gists_url":"https://api.github.com/users/scala/gists{/gist_id}","starred_url":"https://api.github.com/users/scala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala/subscriptions","organizations_url":"https://api.github.com/users/scala/orgs","repos_url":"https://api.github.com/users/scala/repos","events_url":"https://api.github.com/users/scala/events{/privacy}","received_events_url":"https://api.github.com/users/scala/received_events","type":"Organization","site_admin":false},"repo":{"id":2888818,"node_id":"MDEwOlJlcG9zaXRvcnkyODg4ODE4","name":"scala","full_name":"scala/scala","owner":{"login":"scala","id":57059,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3MDU5","avatar_url":"https://avatars2.githubusercontent.com/u/57059?v=4","gravatar_id":"","url":"https://api.github.com/users/scala","html_url":"https://github.com/scala","followers_url":"https://api.github.com/users/scala/followers","following_url":"https://api.github.com/users/scala/following{/other_user}","gists_url":"https://api.github.com/users/scala/gists{/gist_id}","starred_url":"https://api.github.com/users/scala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala/subscriptions","organizations_url":"https://api.github.com/users/scala/orgs","repos_url":"https://api.github.com/users/scala/repos","events_url":"https://api.github.com/users/scala/events{/privacy}","received_events_url":"https://api.github.com/users/scala/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scala/scala","description":"The Scala programming language","fork":false,"url":"https://api.github.com/repos/scala/scala","forks_url":"https://api.github.com/repos/scala/scala/forks","keys_url":"https://api.github.com/repos/scala/scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scala/scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scala/scala/teams","hooks_url":"https://api.github.com/repos/scala/scala/hooks","issue_events_url":"https://api.github.com/repos/scala/scala/issues/events{/number}","events_url":"https://api.github.com/repos/scala/scala/events","assignees_url":"https://api.github.com/repos/scala/scala/assignees{/user}","branches_url":"https://api.github.com/repos/scala/scala/branches{/branch}","tags_url":"https://api.github.com/repos/scala/scala/tags","blobs_url":"https://api.github.com/repos/scala/scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scala/scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scala/scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/scala/scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scala/scala/statuses/{sha}","languages_url":"https://api.github.com/repos/scala/scala/languages","stargazers_url":"https://api.github.com/repos/scala/scala/stargazers","contributors_url":"https://api.github.com/repos/scala/scala/contributors","subscribers_url":"https://api.github.com/repos/scala/scala/subscribers","subscription_url":"https://api.github.com/repos/scala/scala/subscription","commits_url":"https://api.github.com/repos/scala/scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/scala/scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/scala/scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/scala/scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/scala/scala/contents/{+path}","compare_url":"https://api.github.com/repos/scala/scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scala/scala/merges","archive_url":"https://api.github.com/repos/scala/scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scala/scala/downloads","issues_url":"https://api.github.com/repos/scala/scala/issues{/number}","pulls_url":"https://api.github.com/repos/scala/scala/pulls{/number}","milestones_url":"https://api.github.com/repos/scala/scala/milestones{/number}","notifications_url":"https://api.github.com/repos/scala/scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scala/scala/labels{/name}","releases_url":"https://api.github.com/repos/scala/scala/releases{/id}","deployments_url":"https://api.github.com/repos/scala/scala/deployments","created_at":"2011-12-01T05:02:34Z","updated_at":"2018-08-01T06:18:55Z","pushed_at":"2018-08-01T07:33:39Z","git_url":"git://github.com/scala/scala.git","ssh_url":"git@github.com:scala/scala.git","clone_url":"https://github.com/scala/scala.git","svn_url":"https://github.com/scala/scala","homepage":"http://www.scala-lang.org/","size":100503,"stargazers_count":10485,"watchers_count":10485,"language":"Scala","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2482,"mirror_url":null,"archived":false,"open_issues_count":104,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":2482,"open_issues":104,"watchers":10485,"default_branch":"2.13.x"}},"_links":{"self":{"href":"https://api.github.com/repos/scala/scala/pulls/6907"},"html":{"href":"https://github.com/scala/scala/pull/6907"},"issue":{"href":"https://api.github.com/repos/scala/scala/issues/6907"},"comments":{"href":"https://api.github.com/repos/scala/scala/issues/6907/comments"},"review_comments":{"href":"https://api.github.com/repos/scala/scala/pulls/6907/comments"},"review_comment":{"href":"https://api.github.com/repos/scala/scala/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scala/scala/pulls/6907/commits"},"statuses":{"href":"https://api.github.com/repos/scala/scala/statuses/97f2a857f4af03d20d0aa8649f9ff0d0e84bc0e2"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"kmizu"}}