{"action":"created","issue":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/1188","repository_url":"https://api.github.com/repos/lampepfl/dotty","labels_url":"https://api.github.com/repos/lampepfl/dotty/issues/1188/labels{/name}","comments_url":"https://api.github.com/repos/lampepfl/dotty/issues/1188/comments","events_url":"https://api.github.com/repos/lampepfl/dotty/issues/1188/events","html_url":"https://github.com/lampepfl/dotty/pull/1188","id":142933436,"number":1188,"title":"Fix #1167: Remove the magic from Arrays.newRefArray.","user":{"login":"sjrd","id":535934,"avatar_url":"https://avatars.githubusercontent.com/u/535934?v=3","gravatar_id":"","url":"https://api.github.com/users/sjrd","html_url":"https://github.com/sjrd","followers_url":"https://api.github.com/users/sjrd/followers","following_url":"https://api.github.com/users/sjrd/following{/other_user}","gists_url":"https://api.github.com/users/sjrd/gists{/gist_id}","starred_url":"https://api.github.com/users/sjrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjrd/subscriptions","organizations_url":"https://api.github.com/users/sjrd/orgs","repos_url":"https://api.github.com/users/sjrd/repos","events_url":"https://api.github.com/users/sjrd/events{/privacy}","received_events_url":"https://api.github.com/users/sjrd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2016-03-23T11:24:30Z","updated_at":"2016-03-23T20:12:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/lampepfl/dotty/pulls/1188","html_url":"https://github.com/lampepfl/dotty/pull/1188","diff_url":"https://github.com/lampepfl/dotty/pull/1188.diff","patch_url":"https://github.com/lampepfl/dotty/pull/1188.patch"},"body":"Previously, the method `Arrays.newRefArray` was one of the only 3\r\nmethods that are kept generic after erasure. This commit removes\r\nthis magic, by making it take an actual `j.l.Class[T]` as\r\nparameter.\r\n\r\nMoreover, the methods `newXArray` all receive an actual body,\r\nimplemented on top of Java reflection, which means that a back-end\r\ndoes not *have to* special-case those methods for correctness.\r\nIt might still be required for performance, though, depending on\r\nthe back-end.\r\n\r\nThe JVM back-end is made non-optimal in this commit, precisely\r\nbecause it does not specialize that method anymore. Doing so\r\nrequires modifying the fork of scalac that we use, which should\r\nbe done separately.\r\n\r\nThe JS back-end is adapted simply by doing nothing at all on any\r\nof the `newXArray` methods. It will normally call the user-space\r\nimplementations which use reflection. The Scala.js optimizer will\r\ninline and intrinsify the reflective calls, producing optimal\r\ncode, at the end of the day."},"comment":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/comments/200524237","html_url":"https://github.com/lampepfl/dotty/pull/1188#issuecomment-200524237","issue_url":"https://api.github.com/repos/lampepfl/dotty/issues/1188","id":200524237,"user":{"login":"DarkDimius","id":1084930,"avatar_url":"https://avatars.githubusercontent.com/u/1084930?v=3","gravatar_id":"","url":"https://api.github.com/users/DarkDimius","html_url":"https://github.com/DarkDimius","followers_url":"https://api.github.com/users/DarkDimius/followers","following_url":"https://api.github.com/users/DarkDimius/following{/other_user}","gists_url":"https://api.github.com/users/DarkDimius/gists{/gist_id}","starred_url":"https://api.github.com/users/DarkDimius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DarkDimius/subscriptions","organizations_url":"https://api.github.com/users/DarkDimius/orgs","repos_url":"https://api.github.com/users/DarkDimius/repos","events_url":"https://api.github.com/users/DarkDimius/events{/privacy}","received_events_url":"https://api.github.com/users/DarkDimius/received_events","type":"User","site_admin":false},"created_at":"2016-03-23T20:12:18Z","updated_at":"2016-03-23T20:12:18Z","body":"@retronym thx for suggestion. Implemented: https://github.com/lampepfl/dotty/pull/1188/commits/b2215ed23311b2c99ea638f9d7fcad9737dba588\r\n"}}