{"action":"created","comment":{"url":"https://api.github.com/repos/scala-js/scala-js/pulls/comments/40590401","id":40590401,"diff_hunk":"@@ -219,5 +219,100 @@ object Math {\n     }\n   }\n \n-  // TODO The methods not available in the JavaScript Math object\n+  def addExact(a: scala.Int, b: scala.Int): scala.Int = {\n+    val overflow =\n+      b > 0 && a > Integer.MAX_VALUE - b || b < 0 && a < Integer.MIN_VALUE - b\n+    if (!overflow) a + b\n+    else throw new ArithmeticException(\"Integer overflow\")\n+  }\n+\n+  def addExact(a: scala.Long, b: scala.Long): scala.Long = {\n+    val overflow =\n+      b > 0 && a > Long.MAX_VALUE - b || b < 0 && a < Long.MIN_VALUE - b\n+    if (!overflow) a + b\n+    else throw new ArithmeticException(\"Long overflow\")\n+  }\n+\n+  def subtractExact(a: scala.Int, b: scala.Int): scala.Int = {\n+    val overflow =\n+      b < 0 && a > Integer.MAX_VALUE + b || b > 0 && a < Integer.MIN_VALUE + b\n+    if (!overflow) a - b\n+    else throw new ArithmeticException(\"Integer overflow\")\n+  }\n+\n+  def subtractExact(a: scala.Long, b: scala.Long): scala.Long = {\n+    val overflow =\n+      b < 0 && a > Long.MAX_VALUE + b || b > 0 && a < Long.MIN_VALUE + b\n+    if (!overflow) a - b\n+    else throw new ArithmeticException(\"Long overflow\")","path":"javalanglib/src/main/scala/java/lang/Math.scala","position":null,"original_position":30,"commit_id":"de14efaef083f52a30df118df988524d40f678a4","original_commit_id":"e75cd9ce892db4c0f5a8f051e3406aec5a3a04e1","user":{"login":"ummels","id":287491,"avatar_url":"https://avatars.githubusercontent.com/u/287491?v=3","gravatar_id":"","url":"https://api.github.com/users/ummels","html_url":"https://github.com/ummels","followers_url":"https://api.github.com/users/ummels/followers","following_url":"https://api.github.com/users/ummels/following{/other_user}","gists_url":"https://api.github.com/users/ummels/gists{/gist_id}","starred_url":"https://api.github.com/users/ummels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ummels/subscriptions","organizations_url":"https://api.github.com/users/ummels/orgs","repos_url":"https://api.github.com/users/ummels/repos","events_url":"https://api.github.com/users/ummels/events{/privacy}","received_events_url":"https://api.github.com/users/ummels/received_events","type":"User","site_admin":false},"body":"Thanks.","created_at":"2015-09-28T18:54:02Z","updated_at":"2015-09-28T18:54:02Z","html_url":"https://github.com/scala-js/scala-js/pull/1901#discussion_r40590401","pull_request_url":"https://api.github.com/repos/scala-js/scala-js/pulls/1901","_links":{"self":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/comments/40590401"},"html":{"href":"https://github.com/scala-js/scala-js/pull/1901#discussion_r40590401"},"pull_request":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/1901"}}},"pull_request":{"url":"https://api.github.com/repos/scala-js/scala-js/pulls/1901","id":44873086,"html_url":"https://github.com/scala-js/scala-js/pull/1901","diff_url":"https://github.com/scala-js/scala-js/pull/1901.diff","patch_url":"https://github.com/scala-js/scala-js/pull/1901.patch","issue_url":"https://api.github.com/repos/scala-js/scala-js/issues/1901","number":1901,"state":"open","locked":false,"title":"Add first batch of java.time classes","user":{"login":"ummels","id":287491,"avatar_url":"https://avatars.githubusercontent.com/u/287491?v=3","gravatar_id":"","url":"https://api.github.com/users/ummels","html_url":"https://github.com/ummels","followers_url":"https://api.github.com/users/ummels/followers","following_url":"https://api.github.com/users/ummels/following{/other_user}","gists_url":"https://api.github.com/users/ummels/gists{/gist_id}","starred_url":"https://api.github.com/users/ummels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ummels/subscriptions","organizations_url":"https://api.github.com/users/ummels/orgs","repos_url":"https://api.github.com/users/ummels/repos","events_url":"https://api.github.com/users/ummels/events{/privacy}","received_events_url":"https://api.github.com/users/ummels/received_events","type":"User","site_admin":false},"body":"This PR addresses #1618 and adds implementations for an initial batch of java.time classes, namely Duration and LocalTime. Since these classes depend on other classes and interfaces, mostly from java.time.temporal, the relevant classes are also implemented.\r\n\r\nThis PR also adds an implementation of java.lang.Enum in order to not violate the DRY principle (from the initial batch both java.time.temporal.ChronoUnit and java.time.temporal.ChronoField descend from java.lang.Enum).","created_at":"2015-09-13T13:45:25Z","updated_at":"2015-09-28T18:54:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0412bc25da06853e5d62a6de09327f423124f761","assignee":{"login":"nicolasstucki","id":3648029,"avatar_url":"https://avatars.githubusercontent.com/u/3648029?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolasstucki","html_url":"https://github.com/nicolasstucki","followers_url":"https://api.github.com/users/nicolasstucki/followers","following_url":"https://api.github.com/users/nicolasstucki/following{/other_user}","gists_url":"https://api.github.com/users/nicolasstucki/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolasstucki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolasstucki/subscriptions","organizations_url":"https://api.github.com/users/nicolasstucki/orgs","repos_url":"https://api.github.com/users/nicolasstucki/repos","events_url":"https://api.github.com/users/nicolasstucki/events{/privacy}","received_events_url":"https://api.github.com/users/nicolasstucki/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/scala-js/scala-js/pulls/1901/commits","review_comments_url":"https://api.github.com/repos/scala-js/scala-js/pulls/1901/comments","review_comment_url":"https://api.github.com/repos/scala-js/scala-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scala-js/scala-js/issues/1901/comments","statuses_url":"https://api.github.com/repos/scala-js/scala-js/statuses/de14efaef083f52a30df118df988524d40f678a4","head":{"label":"ummels:javatime","ref":"javatime","sha":"de14efaef083f52a30df118df988524d40f678a4","user":{"login":"ummels","id":287491,"avatar_url":"https://avatars.githubusercontent.com/u/287491?v=3","gravatar_id":"","url":"https://api.github.com/users/ummels","html_url":"https://github.com/ummels","followers_url":"https://api.github.com/users/ummels/followers","following_url":"https://api.github.com/users/ummels/following{/other_user}","gists_url":"https://api.github.com/users/ummels/gists{/gist_id}","starred_url":"https://api.github.com/users/ummels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ummels/subscriptions","organizations_url":"https://api.github.com/users/ummels/orgs","repos_url":"https://api.github.com/users/ummels/repos","events_url":"https://api.github.com/users/ummels/events{/privacy}","received_events_url":"https://api.github.com/users/ummels/received_events","type":"User","site_admin":false},"repo":{"id":40553788,"name":"scala-js","full_name":"ummels/scala-js","owner":{"login":"ummels","id":287491,"avatar_url":"https://avatars.githubusercontent.com/u/287491?v=3","gravatar_id":"","url":"https://api.github.com/users/ummels","html_url":"https://github.com/ummels","followers_url":"https://api.github.com/users/ummels/followers","following_url":"https://api.github.com/users/ummels/following{/other_user}","gists_url":"https://api.github.com/users/ummels/gists{/gist_id}","starred_url":"https://api.github.com/users/ummels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ummels/subscriptions","organizations_url":"https://api.github.com/users/ummels/orgs","repos_url":"https://api.github.com/users/ummels/repos","events_url":"https://api.github.com/users/ummels/events{/privacy}","received_events_url":"https://api.github.com/users/ummels/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ummels/scala-js","description":"Scala.js, the Scala to JavaScript compiler","fork":true,"url":"https://api.github.com/repos/ummels/scala-js","forks_url":"https://api.github.com/repos/ummels/scala-js/forks","keys_url":"https://api.github.com/repos/ummels/scala-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ummels/scala-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ummels/scala-js/teams","hooks_url":"https://api.github.com/repos/ummels/scala-js/hooks","issue_events_url":"https://api.github.com/repos/ummels/scala-js/issues/events{/number}","events_url":"https://api.github.com/repos/ummels/scala-js/events","assignees_url":"https://api.github.com/repos/ummels/scala-js/assignees{/user}","branches_url":"https://api.github.com/repos/ummels/scala-js/branches{/branch}","tags_url":"https://api.github.com/repos/ummels/scala-js/tags","blobs_url":"https://api.github.com/repos/ummels/scala-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ummels/scala-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ummels/scala-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/ummels/scala-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ummels/scala-js/statuses/{sha}","languages_url":"https://api.github.com/repos/ummels/scala-js/languages","stargazers_url":"https://api.github.com/repos/ummels/scala-js/stargazers","contributors_url":"https://api.github.com/repos/ummels/scala-js/contributors","subscribers_url":"https://api.github.com/repos/ummels/scala-js/subscribers","subscription_url":"https://api.github.com/repos/ummels/scala-js/subscription","commits_url":"https://api.github.com/repos/ummels/scala-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/ummels/scala-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/ummels/scala-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/ummels/scala-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/ummels/scala-js/contents/{+path}","compare_url":"https://api.github.com/repos/ummels/scala-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ummels/scala-js/merges","archive_url":"https://api.github.com/repos/ummels/scala-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ummels/scala-js/downloads","issues_url":"https://api.github.com/repos/ummels/scala-js/issues{/number}","pulls_url":"https://api.github.com/repos/ummels/scala-js/pulls{/number}","milestones_url":"https://api.github.com/repos/ummels/scala-js/milestones{/number}","notifications_url":"https://api.github.com/repos/ummels/scala-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ummels/scala-js/labels{/name}","releases_url":"https://api.github.com/repos/ummels/scala-js/releases{/id}","created_at":"2015-08-11T16:50:35Z","updated_at":"2015-08-11T16:50:38Z","pushed_at":"2015-09-28T18:51:43Z","git_url":"git://github.com/ummels/scala-js.git","ssh_url":"git@github.com:ummels/scala-js.git","clone_url":"https://github.com/ummels/scala-js.git","svn_url":"https://github.com/ummels/scala-js","homepage":"http://www.scala-js.org/","size":9444,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"scala-js:master","ref":"master","sha":"e51625a62faf464f5a68fdc97e6670757c3971c9","user":{"login":"scala-js","id":6039724,"avatar_url":"https://avatars.githubusercontent.com/u/6039724?v=3","gravatar_id":"","url":"https://api.github.com/users/scala-js","html_url":"https://github.com/scala-js","followers_url":"https://api.github.com/users/scala-js/followers","following_url":"https://api.github.com/users/scala-js/following{/other_user}","gists_url":"https://api.github.com/users/scala-js/gists{/gist_id}","starred_url":"https://api.github.com/users/scala-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala-js/subscriptions","organizations_url":"https://api.github.com/users/scala-js/orgs","repos_url":"https://api.github.com/users/scala-js/repos","events_url":"https://api.github.com/users/scala-js/events{/privacy}","received_events_url":"https://api.github.com/users/scala-js/received_events","type":"Organization","site_admin":false},"repo":{"id":8272315,"name":"scala-js","full_name":"scala-js/scala-js","owner":{"login":"scala-js","id":6039724,"avatar_url":"https://avatars.githubusercontent.com/u/6039724?v=3","gravatar_id":"","url":"https://api.github.com/users/scala-js","html_url":"https://github.com/scala-js","followers_url":"https://api.github.com/users/scala-js/followers","following_url":"https://api.github.com/users/scala-js/following{/other_user}","gists_url":"https://api.github.com/users/scala-js/gists{/gist_id}","starred_url":"https://api.github.com/users/scala-js/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala-js/subscriptions","organizations_url":"https://api.github.com/users/scala-js/orgs","repos_url":"https://api.github.com/users/scala-js/repos","events_url":"https://api.github.com/users/scala-js/events{/privacy}","received_events_url":"https://api.github.com/users/scala-js/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scala-js/scala-js","description":"Scala.js, the Scala to JavaScript compiler","fork":false,"url":"https://api.github.com/repos/scala-js/scala-js","forks_url":"https://api.github.com/repos/scala-js/scala-js/forks","keys_url":"https://api.github.com/repos/scala-js/scala-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scala-js/scala-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scala-js/scala-js/teams","hooks_url":"https://api.github.com/repos/scala-js/scala-js/hooks","issue_events_url":"https://api.github.com/repos/scala-js/scala-js/issues/events{/number}","events_url":"https://api.github.com/repos/scala-js/scala-js/events","assignees_url":"https://api.github.com/repos/scala-js/scala-js/assignees{/user}","branches_url":"https://api.github.com/repos/scala-js/scala-js/branches{/branch}","tags_url":"https://api.github.com/repos/scala-js/scala-js/tags","blobs_url":"https://api.github.com/repos/scala-js/scala-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scala-js/scala-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scala-js/scala-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/scala-js/scala-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scala-js/scala-js/statuses/{sha}","languages_url":"https://api.github.com/repos/scala-js/scala-js/languages","stargazers_url":"https://api.github.com/repos/scala-js/scala-js/stargazers","contributors_url":"https://api.github.com/repos/scala-js/scala-js/contributors","subscribers_url":"https://api.github.com/repos/scala-js/scala-js/subscribers","subscription_url":"https://api.github.com/repos/scala-js/scala-js/subscription","commits_url":"https://api.github.com/repos/scala-js/scala-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/scala-js/scala-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/scala-js/scala-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/scala-js/scala-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/scala-js/scala-js/contents/{+path}","compare_url":"https://api.github.com/repos/scala-js/scala-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scala-js/scala-js/merges","archive_url":"https://api.github.com/repos/scala-js/scala-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scala-js/scala-js/downloads","issues_url":"https://api.github.com/repos/scala-js/scala-js/issues{/number}","pulls_url":"https://api.github.com/repos/scala-js/scala-js/pulls{/number}","milestones_url":"https://api.github.com/repos/scala-js/scala-js/milestones{/number}","notifications_url":"https://api.github.com/repos/scala-js/scala-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scala-js/scala-js/labels{/name}","releases_url":"https://api.github.com/repos/scala-js/scala-js/releases{/id}","created_at":"2013-02-18T16:33:55Z","updated_at":"2015-09-28T17:14:34Z","pushed_at":"2015-09-28T18:51:44Z","git_url":"git://github.com/scala-js/scala-js.git","ssh_url":"git@github.com:scala-js/scala-js.git","clone_url":"https://github.com/scala-js/scala-js.git","svn_url":"https://github.com/scala-js/scala-js","homepage":"http://www.scala-js.org/","size":17429,"stargazers_count":1848,"watchers_count":1848,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":164,"mirror_url":null,"open_issues_count":76,"forks":164,"open_issues":76,"watchers":1848,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/1901"},"html":{"href":"https://github.com/scala-js/scala-js/pull/1901"},"issue":{"href":"https://api.github.com/repos/scala-js/scala-js/issues/1901"},"comments":{"href":"https://api.github.com/repos/scala-js/scala-js/issues/1901/comments"},"review_comments":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/1901/comments"},"review_comment":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scala-js/scala-js/pulls/1901/commits"},"statuses":{"href":"https://api.github.com/repos/scala-js/scala-js/statuses/de14efaef083f52a30df118df988524d40f678a4"}}}}