{"action":"closed","number":5003,"pull_request":{"url":"https://api.github.com/repos/scala/scala/pulls/5003","id":61213624,"html_url":"https://github.com/scala/scala/pull/5003","diff_url":"https://github.com/scala/scala/pull/5003.diff","patch_url":"https://github.com/scala/scala/pull/5003.patch","issue_url":"https://api.github.com/repos/scala/scala/issues/5003","number":5003,"state":"closed","locked":false,"title":"New trait encoding using default methods [ci: last-only]","user":{"login":"retronym","id":65551,"avatar_url":"https://avatars.githubusercontent.com/u/65551?v=3","gravatar_id":"","url":"https://api.github.com/users/retronym","html_url":"https://github.com/retronym","followers_url":"https://api.github.com/users/retronym/followers","following_url":"https://api.github.com/users/retronym/following{/other_user}","gists_url":"https://api.github.com/users/retronym/gists{/gist_id}","starred_url":"https://api.github.com/users/retronym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retronym/subscriptions","organizations_url":"https://api.github.com/users/retronym/orgs","repos_url":"https://api.github.com/users/retronym/repos","events_url":"https://api.github.com/users/retronym/events{/privacy}","received_events_url":"https://api.github.com/users/retronym/received_events","type":"User","site_admin":false},"body":"Until now, concrete methods in traits were encoded with \"trait implementation classes\".\r\n\r\n  - Such a trait would compile to two class files\r\n    - the trait interface, a Java interface, and\r\n    - the implementation class, containing \"trait implementation methods\"\r\n  - trait implementation methods are static methods has an explicit self parameter. \r\n  - some methods don't require addition of an interface method, such as private methods. Calls to these directly call the implementation method\r\n  - classes that mixin a trait install \"trait forwarders\", which implement the abstract method in the interface by forwarding to the trait implementation method.\r\n\r\nThe new encoding:\r\n  - no longer emits trait implementation classes or trait implementation methods.\r\n  - instead, concrete methods are simply retained in the interface, as JVM 8 default interface methods (the JVM spec changes in [JSR-335](http://download.oracle.com/otndocs/jcp/lambda-0_9_3-fr-eval-spec/index.html) paves the way)\r\n  - use `invokespecial` to call private or particular super implementations of a method (rather `invokestatic`)\r\n    - in cases when we `invokespecial` to a method in an indirect ancestor, we add that ancestor redundantly as a direct parent. We are investigating alternatives approaches here.\r\n  - we still emit trait fowrarders, although we are [investigating](https://github.com/scala/scala-dev/issues/98) ways to only do this when the JVM would be unable to resolve the correct method using its rules for default method resolution.\r\n\r\nHere's an example:\r\n\r\n```\r\ntrait T {\r\n  println(\"T\")\r\n  def m1 = m2\r\n  private def m2 = \"m2\"\r\n}\r\ntrait U extends T {\r\n  println(\"T\")\r\n  override def m1 = super[T].m1\r\n}\r\nclass C extends U {\r\n  println(\"C\")\r\n  def test = m1\r\n}\r\n```\r\n\r\nThe old and new encodings are displayed and diffed here: https://gist.github.com/retronym/f174d23f859f0e053580\r\n\r\n## Bootstrapping Plan\r\n\r\n - [x] Update the bootstrap script to generate docs on the second pass of the modules bootstrap when a custom STARR is used.\r\n - [x] Trigger [scala-2.12.x-integrate-bootstrap](https://scala-ci.typesafe.com/view/scala-2.12.x/job/scala-2.12.x-integrate-bootstrap/), with `publishToSonatype=true` and `STARR_REF=`c8e6050 and `SCALA_VER_SUFFIX=-M3-dc9effe` (\"Nuke implementation classes\"): [scala-2.12.x-integrate-bootstrap/351](https://scala-ci.typesafe.com/view/scala-2.12.x/job/scala-2.12.x-integrate-bootstrap/351/console)\r\n - [x] Tag dc9effe (\"\tRemove manual mixins in JFunctionN\") as [v2.11.0-M3-dc9effe](https://github.com/scala/scala/releases/tag/v2.12.0-M3-dc9effe)\r\n - [x] Promote the resulting release (including modules) to Maven Central.\r\n - [x] [Ask](https://github.com/rickynils/scalacheck/issues/225) @rickynils to publish a ScalaCheck release against this build. (We used a locally built version during the bootstrap script, but that won't be available when we use this as a STARR)\r\n - [x] Rework (\"Update STARR to freshly bootstrapped build\") to set `starr.version=v2.11.0-M4-089b836` and remove the temporary build scaffolding to use the release-temp repository.\r\n - [ ] Merge this PR. dc9effe will be the only commit that doesn't build directly (it only builds with `bootstrap STARR_REF=HEAD^1 ..`)\r\n - [ ] [Update the references to 2.12.0-M3](https://github.com/scala/community-builds/pull/232) in the `scalaVersion` override for `scala-{xml, parser-combinators}` in the community build.\r\n\r\nVariations to discuss:\r\n - [x] Squash the last commits in this PR back into \"Nuke implementation classes\" before doing this.\r\n - [ ] Squash \"Nuke implementation classes\", \"Remove manual mixins in JFunctionN\", and \"Update STARR to freshly bootstrapped build\" before merging to 2.12.x, with a commit message that points to the tag v2.11.0-M4-089b836 which contains the finer grained commits.\r\n - [x] Does the tag v2.11.0-M3-089b836 make more sense? Ideally, Maven's ordering scheme would consider `2.11.0-M3 < XXXXX-089b836 < 2.11.0-M4`. Decision: Use `M3-`\r\n","created_at":"2016-03-01T09:23:47Z","updated_at":"2016-03-21T03:03:17Z","closed_at":"2016-03-21T03:03:16Z","merged_at":"2016-03-21T03:03:16Z","merge_commit_sha":"062a4ad2de10b028c1fee67e660ee87bdce57ace","assignee":{"login":"adriaanm","id":91083,"avatar_url":"https://avatars.githubusercontent.com/u/91083?v=3","gravatar_id":"","url":"https://api.github.com/users/adriaanm","html_url":"https://github.com/adriaanm","followers_url":"https://api.github.com/users/adriaanm/followers","following_url":"https://api.github.com/users/adriaanm/following{/other_user}","gists_url":"https://api.github.com/users/adriaanm/gists{/gist_id}","starred_url":"https://api.github.com/users/adriaanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriaanm/subscriptions","organizations_url":"https://api.github.com/users/adriaanm/orgs","repos_url":"https://api.github.com/users/adriaanm/repos","events_url":"https://api.github.com/users/adriaanm/events{/privacy}","received_events_url":"https://api.github.com/users/adriaanm/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/scala/scala/milestones/51","html_url":"https://github.com/scala/scala/milestones/2.12.0-M4","labels_url":"https://api.github.com/repos/scala/scala/milestones/51/labels","id":1337791,"number":51,"title":"2.12.0-M4","description":"Leads: @sethtisue & @adriaanm\r\n\r\n  - [ ] traits: compile to interfaces with default methods (retronym, adriaanm) #5003\r\n  - [ ] SAM: enable by default, desugar function literals for non-`FunctionN` SAM types to `Function` trees and indylambda (instead of creating an anonymous class during typer) #4971\r\n  - [ ] classpath: enable `-YclasspathImpl:flat` by default (lrytz)\r\n  - [ ] RC1 release of scala-java8-compat: collections integration with Java 8 Streams (szeiger & ichoran)\r\n  - [X] traits: use INDY instead of static fields in implementation classes, which are no longer emitted (retronym) \r\n  - [X] optimizer: Copy propagation, remove unused values (closures!) and local variables  (lrytz)\r\n  - [X] optimizer: box-unbox elimination (lrytz)\r\n  - [X] remove genicode (ensure sbt/ide/... still works) (soc, lrytz)\r\n","creator":{"login":"lrytz","id":119636,"avatar_url":"https://avatars.githubusercontent.com/u/119636?v=3","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":9,"closed_issues":113,"state":"open","created_at":"2015-10-05T09:46:45Z","updated_at":"2016-03-21T03:03:16Z","due_on":"2016-03-21T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scala/scala/pulls/5003/commits","review_comments_url":"https://api.github.com/repos/scala/scala/pulls/5003/comments","review_comment_url":"https://api.github.com/repos/scala/scala/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scala/scala/issues/5003/comments","statuses_url":"https://api.github.com/repos/scala/scala/statuses/41d5b9f33fc21c993c676c0389e5f4e7dc66166c","head":{"label":"retronym:topic/nuke-impl-classes-sans-fields","ref":"topic/nuke-impl-classes-sans-fields","sha":"41d5b9f33fc21c993c676c0389e5f4e7dc66166c","user":{"login":"retronym","id":65551,"avatar_url":"https://avatars.githubusercontent.com/u/65551?v=3","gravatar_id":"","url":"https://api.github.com/users/retronym","html_url":"https://github.com/retronym","followers_url":"https://api.github.com/users/retronym/followers","following_url":"https://api.github.com/users/retronym/following{/other_user}","gists_url":"https://api.github.com/users/retronym/gists{/gist_id}","starred_url":"https://api.github.com/users/retronym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retronym/subscriptions","organizations_url":"https://api.github.com/users/retronym/orgs","repos_url":"https://api.github.com/users/retronym/repos","events_url":"https://api.github.com/users/retronym/events{/privacy}","received_events_url":"https://api.github.com/users/retronym/received_events","type":"User","site_admin":false},"repo":{"id":2902104,"name":"scala","full_name":"retronym/scala","owner":{"login":"retronym","id":65551,"avatar_url":"https://avatars.githubusercontent.com/u/65551?v=3","gravatar_id":"","url":"https://api.github.com/users/retronym","html_url":"https://github.com/retronym","followers_url":"https://api.github.com/users/retronym/followers","following_url":"https://api.github.com/users/retronym/following{/other_user}","gists_url":"https://api.github.com/users/retronym/gists{/gist_id}","starred_url":"https://api.github.com/users/retronym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retronym/subscriptions","organizations_url":"https://api.github.com/users/retronym/orgs","repos_url":"https://api.github.com/users/retronym/repos","events_url":"https://api.github.com/users/retronym/events{/privacy}","received_events_url":"https://api.github.com/users/retronym/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/retronym/scala","description":"The Scala programming language","fork":true,"url":"https://api.github.com/repos/retronym/scala","forks_url":"https://api.github.com/repos/retronym/scala/forks","keys_url":"https://api.github.com/repos/retronym/scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/retronym/scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/retronym/scala/teams","hooks_url":"https://api.github.com/repos/retronym/scala/hooks","issue_events_url":"https://api.github.com/repos/retronym/scala/issues/events{/number}","events_url":"https://api.github.com/repos/retronym/scala/events","assignees_url":"https://api.github.com/repos/retronym/scala/assignees{/user}","branches_url":"https://api.github.com/repos/retronym/scala/branches{/branch}","tags_url":"https://api.github.com/repos/retronym/scala/tags","blobs_url":"https://api.github.com/repos/retronym/scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/retronym/scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/retronym/scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/retronym/scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/retronym/scala/statuses/{sha}","languages_url":"https://api.github.com/repos/retronym/scala/languages","stargazers_url":"https://api.github.com/repos/retronym/scala/stargazers","contributors_url":"https://api.github.com/repos/retronym/scala/contributors","subscribers_url":"https://api.github.com/repos/retronym/scala/subscribers","subscription_url":"https://api.github.com/repos/retronym/scala/subscription","commits_url":"https://api.github.com/repos/retronym/scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/retronym/scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/retronym/scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/retronym/scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/retronym/scala/contents/{+path}","compare_url":"https://api.github.com/repos/retronym/scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/retronym/scala/merges","archive_url":"https://api.github.com/repos/retronym/scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/retronym/scala/downloads","issues_url":"https://api.github.com/repos/retronym/scala/issues{/number}","pulls_url":"https://api.github.com/repos/retronym/scala/pulls{/number}","milestones_url":"https://api.github.com/repos/retronym/scala/milestones{/number}","notifications_url":"https://api.github.com/repos/retronym/scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/retronym/scala/labels{/name}","releases_url":"https://api.github.com/repos/retronym/scala/releases{/id}","deployments_url":"https://api.github.com/repos/retronym/scala/deployments","created_at":"2011-12-02T23:04:11Z","updated_at":"2015-05-09T21:40:12Z","pushed_at":"2016-03-18T07:02:48Z","git_url":"git://github.com/retronym/scala.git","ssh_url":"git@github.com:retronym/scala.git","clone_url":"https://github.com/retronym/scala.git","svn_url":"https://github.com/retronym/scala","homepage":"http://www.scala-lang.org/","size":89103,"stargazers_count":5,"watchers_count":5,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":5,"default_branch":"master"}},"base":{"label":"scala:2.12.x","ref":"2.12.x","sha":"99a82be91cbb85239f70508f6695c6b21fd3558c","user":{"login":"scala","id":57059,"avatar_url":"https://avatars.githubusercontent.com/u/57059?v=3","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,"name":"scala","full_name":"scala/scala","owner":{"login":"scala","id":57059,"avatar_url":"https://avatars.githubusercontent.com/u/57059?v=3","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":"2016-03-20T17:31:49Z","pushed_at":"2016-03-21T03:03:16Z","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":140689,"stargazers_count":5801,"watchers_count":5801,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1456,"mirror_url":null,"open_issues_count":34,"forks":1456,"open_issues":34,"watchers":5801,"default_branch":"2.12.x"}},"_links":{"self":{"href":"https://api.github.com/repos/scala/scala/pulls/5003"},"html":{"href":"https://github.com/scala/scala/pull/5003"},"issue":{"href":"https://api.github.com/repos/scala/scala/issues/5003"},"comments":{"href":"https://api.github.com/repos/scala/scala/issues/5003/comments"},"review_comments":{"href":"https://api.github.com/repos/scala/scala/pulls/5003/comments"},"review_comment":{"href":"https://api.github.com/repos/scala/scala/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scala/scala/pulls/5003/commits"},"statuses":{"href":"https://api.github.com/repos/scala/scala/statuses/41d5b9f33fc21c993c676c0389e5f4e7dc66166c"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"adriaanm","id":91083,"avatar_url":"https://avatars.githubusercontent.com/u/91083?v=3","gravatar_id":"","url":"https://api.github.com/users/adriaanm","html_url":"https://github.com/adriaanm","followers_url":"https://api.github.com/users/adriaanm/followers","following_url":"https://api.github.com/users/adriaanm/following{/other_user}","gists_url":"https://api.github.com/users/adriaanm/gists{/gist_id}","starred_url":"https://api.github.com/users/adriaanm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriaanm/subscriptions","organizations_url":"https://api.github.com/users/adriaanm/orgs","repos_url":"https://api.github.com/users/adriaanm/repos","events_url":"https://api.github.com/users/adriaanm/events{/privacy}","received_events_url":"https://api.github.com/users/adriaanm/received_events","type":"User","site_admin":false},"comments":34,"review_comments":0,"commits":4,"additions":513,"deletions":1428,"changed_files":88}}