{"action":"created","comment":{"url":"https://api.github.com/repos/scala/scala/pulls/comments/30373886","id":30373886,"diff_hunk":"@@ -105,6 +107,12 @@ abstract class Delambdafy extends Transform with TypingTransformers with ast.Tre\n             // ... or an invokedynamic call\n             super.transform(apply)\n         }\n+      case Template(_, _, _) =>\n+        try {\n+          // during this call boxingBridgeMethods will be populated from the Function case\n+          val Template(parents, self, body) = super.transform(tree)\n+          Template(parents, self, body ++ boxingBridgeMethods)","path":"src/compiler/scala/tools/nsc/transform/Delambdafy.scala","position":17,"original_position":17,"commit_id":"14929d79444f747d989443a808a4ce3e71b56205","original_commit_id":"14929d79444f747d989443a808a4ce3e71b56205","user":{"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},"body":"I couldn't easily/lazily convince myself this deals correctly with nested templates. Could you shed some light on that?","created_at":"2015-05-14T23:30:01Z","updated_at":"2015-05-14T23:30:01Z","html_url":"https://github.com/scala/scala/pull/4497#discussion_r30373886","pull_request_url":"https://api.github.com/repos/scala/scala/pulls/4497","_links":{"self":{"href":"https://api.github.com/repos/scala/scala/pulls/comments/30373886"},"html":{"href":"https://github.com/scala/scala/pull/4497#discussion_r30373886"},"pull_request":{"href":"https://api.github.com/repos/scala/scala/pulls/4497"}}},"pull_request":{"url":"https://api.github.com/repos/scala/scala/pulls/4497","id":35100219,"html_url":"https://github.com/scala/scala/pull/4497","diff_url":"https://github.com/scala/scala/pull/4497.diff","patch_url":"https://github.com/scala/scala/pull/4497.patch","issue_url":"https://api.github.com/repos/scala/scala/issues/4497","number":4497,"state":"open","locked":false,"title":"[indylambda] Relieve LambdaMetafactory of boxing duties [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":"`LambdaMetafactory` generates code to perform a limited number of type\nadaptations when delegating from its implementation of the functional\ninterface method to the lambda target method.\n\nThese adaptations are: numeric widening, casting, boxing and unboxing.\n\nHowever, the semantics of unboxing numerics in Java differs to Scala: they\ntreat `UNBOX(null)` as cause to rause a `NullPointerException`, Scala (in\n`BoxesRuntime.unboxTo{Byte,Short,...}`) reinterprets the null as zero.\n\nFurthermore, Java has no idea how to adapt between a value class and its\nwrapped type, nor from a void return to `BoxedUnit`.\n\nThis commit detects when the lambda target method would require such\nadaptation. If it does, an extra method, `$anonfun$1$adapted` is created to\nperform the adaptation, and this is used as the target of the lambda.\n\nThis obviates the use of `JProcedureN` for `Unit` returning lambdas, we\nknow use `JFunctionN` as the functional interface and bind this to an\n`$adapted` method that summons the instance of `BoxedUnit` after calling\nthe `void` returning lambda target.\n\nThe enclosed test cases fail without boxing changes. They don't execute\nwith indylambda enabled under regular partest runs yet, you need to add\nscala-java8-compat to scala-library and pass the SCALAC_OPTS to partest\nmanually to try this out, as described in\nhttps://github.com/scala/scala/pull/4463. Once we enable indylambda by\ndefault, however, this test will exercise the code in this patch all the\ntime.\n\nIt is also possible to run the tests with:\n\n```\n% curl\nhttps://oss.sonatype.org/content/repositories/releases/org/scala-lang/modules/scala-java8-t_2.11/0.4.0/scala-java8-compat_2.11-0.4.0.jar\n> scala-java8-compat_2.11-0.4.0.jar\n% export INDYLAMBDA=\"-Ydelambdafy:method -Ybackend:GenBCode -target:jvm-1.8\n-classpath .:scala-java8-compat_2.11-0.4.0.jar\" qscalac $INDYLAMBDA\ntest/files/run/indylambda-boxing/*.scala && qscala $INDYLAMBDA Test\n```","created_at":"2015-05-11T06:15:11Z","updated_at":"2015-05-14T23:30:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5f73e1c8490dc5b9bb00360be697b9832b0acbcd","assignee":null,"milestone":{"url":"https://api.github.com/repos/scala/scala/milestones/48","html_url":"https://github.com/scala/scala/milestones/2.11.7","labels_url":"https://api.github.com/repos/scala/scala/milestones/48/labels","id":985497,"number":48,"title":"2.11.7","description":"Merge to 2.11.x.\r\n","creator":{"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},"open_issues":9,"closed_issues":106,"state":"open","created_at":"2015-02-19T00:12:20Z","updated_at":"2015-05-12T08:29:53Z","due_on":"2015-06-30T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/scala/scala/pulls/4497/commits","review_comments_url":"https://api.github.com/repos/scala/scala/pulls/4497/comments","review_comment_url":"https://api.github.com/repos/scala/scala/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scala/scala/issues/4497/comments","statuses_url":"https://api.github.com/repos/scala/scala/statuses/14929d79444f747d989443a808a4ce3e71b56205","head":{"label":"retronym:topic/indylambda-diy-boxing","ref":"topic/indylambda-diy-boxing","sha":"14929d79444f747d989443a808a4ce3e71b56205","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}","created_at":"2011-12-02T23:04:11Z","updated_at":"2015-05-09T21:40:12Z","pushed_at":"2015-05-13T02:00:18Z","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":102987,"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":6,"forks":0,"open_issues":6,"watchers":5,"default_branch":"master"}},"base":{"label":"scala:2.11.x","ref":"2.11.x","sha":"4b0e3bc38a6fe58dbcf43fbe1d21ee8467f7326c","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}","created_at":"2011-12-01T05:02:34Z","updated_at":"2015-05-14T21:35:23Z","pushed_at":"2015-05-13T07:39:31Z","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":194211,"stargazers_count":4157,"watchers_count":4157,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1076,"mirror_url":null,"open_issues_count":11,"forks":1076,"open_issues":11,"watchers":4157,"default_branch":"2.11.x"}},"_links":{"self":{"href":"https://api.github.com/repos/scala/scala/pulls/4497"},"html":{"href":"https://github.com/scala/scala/pull/4497"},"issue":{"href":"https://api.github.com/repos/scala/scala/issues/4497"},"comments":{"href":"https://api.github.com/repos/scala/scala/issues/4497/comments"},"review_comments":{"href":"https://api.github.com/repos/scala/scala/pulls/4497/comments"},"review_comment":{"href":"https://api.github.com/repos/scala/scala/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scala/scala/pulls/4497/commits"},"statuses":{"href":"https://api.github.com/repos/scala/scala/statuses/14929d79444f747d989443a808a4ce3e71b56205"}}}}