{"action":"created","comment":{"url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/comments/148181936","pull_request_review_id":73384237,"id":148181936,"diff_hunk":"@@ -99,5 +115,19 @@ fun FileSpec.Builder.addTypes(types: List<TypeSpec>): FileSpec.Builder {\n  * To avoid KotlinPoet bug that returns java.lang.String when type name is kotlin.String.\n  * This method should be removed after addressing on KotlinPoet side.\n  */\n-fun TypeName.checkStringType() =\n-        if (this.toString() == \"java.lang.String\") ClassName(\"kotlin\", \"String\") else this\n+fun TypeName.mapPrimitivesToKotlinTypes() =\n+        when (this.toString()) {\n+            \"java.lang.String\" -> ClassName(\"kotlin\", \"String\")","path":"processor/src/main/kotlin/permissions/dispatcher/processor/util/Extensions.kt","position":46,"original_position":46,"commit_id":"9c262856a65b83d8f8ad3bd9e3ebbe6cc694dc1c","original_commit_id":"9c262856a65b83d8f8ad3bd9e3ebbe6cc694dc1c","user":{"login":"mannodermaus","id":3897705,"avatar_url":"https://avatars2.githubusercontent.com/u/3897705?v=4","gravatar_id":"","url":"https://api.github.com/users/mannodermaus","html_url":"https://github.com/mannodermaus","followers_url":"https://api.github.com/users/mannodermaus/followers","following_url":"https://api.github.com/users/mannodermaus/following{/other_user}","gists_url":"https://api.github.com/users/mannodermaus/gists{/gist_id}","starred_url":"https://api.github.com/users/mannodermaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mannodermaus/subscriptions","organizations_url":"https://api.github.com/users/mannodermaus/orgs","repos_url":"https://api.github.com/users/mannodermaus/repos","events_url":"https://api.github.com/users/mannodermaus/events{/privacy}","received_events_url":"https://api.github.com/users/mannodermaus/received_events","type":"User","site_admin":false},"body":"When it came to nullable primitives, I remember that the generated code favored `@Nullable java.lang.Integer` over `kotlin.Int?`, which was weird. Maybe it's an issue with KotlinPoet? I'll try to reproduce and open a ticket","created_at":"2017-11-01T04:51:08Z","updated_at":"2017-11-01T04:51:08Z","html_url":"https://github.com/permissions-dispatcher/PermissionsDispatcher/pull/398#discussion_r148181936","pull_request_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/398","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/comments/148181936"},"html":{"href":"https://github.com/permissions-dispatcher/PermissionsDispatcher/pull/398#discussion_r148181936"},"pull_request":{"href":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/398"}},"in_reply_to_id":148177411},"pull_request":{"url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/398","id":147562126,"html_url":"https://github.com/permissions-dispatcher/PermissionsDispatcher/pull/398","diff_url":"https://github.com/permissions-dispatcher/PermissionsDispatcher/pull/398.diff","patch_url":"https://github.com/permissions-dispatcher/PermissionsDispatcher/pull/398.patch","issue_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/398","number":398,"state":"open","locked":false,"title":"Honor nullable params in Kotlin","user":{"login":"mannodermaus","id":3897705,"avatar_url":"https://avatars2.githubusercontent.com/u/3897705?v=4","gravatar_id":"","url":"https://api.github.com/users/mannodermaus","html_url":"https://github.com/mannodermaus","followers_url":"https://api.github.com/users/mannodermaus/followers","following_url":"https://api.github.com/users/mannodermaus/following{/other_user}","gists_url":"https://api.github.com/users/mannodermaus/gists{/gist_id}","starred_url":"https://api.github.com/users/mannodermaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mannodermaus/subscriptions","organizations_url":"https://api.github.com/users/mannodermaus/orgs","repos_url":"https://api.github.com/users/mannodermaus/repos","events_url":"https://api.github.com/users/mannodermaus/events{/privacy}","received_events_url":"https://api.github.com/users/mannodermaus/received_events","type":"User","site_admin":false},"body":"Generated Kotlin code needs to honor nullable parameters in the signatures of annotated `@NeedsPermission` methods:\r\n\r\n```kotlin\r\n@RuntimePermissions\r\nclass SomeActivity : AppCompatActivity() {\r\n  @NeedsPermission(Manifest.permission.ACCESS_FINE_LOCATION)\r\n  fun updateLocation(currentLocation: LatLng?) {\r\n    // ...\r\n  }\r\n}\r\n\r\n// Wrong\r\nfun SomeActivity.updateLocationWithPermissionCheck(currentLocation: LatLng) {\r\n}\r\n\r\n// Correct\r\nfun SomeActivity.updateLocationWithPermissionCheck(currentLocation: LatLng?) {\r\n}\r\n```\r\n\r\nAs part of the Parameter-to-TypeName chain, we now inspect the annotations of a `VariableElement` & attach the nullability information to its `TypeName` via a new extension method, `mapToNullableTypeIf(Boolean)`. Since we use this chain in multiple places, I have extracted this mapping into its own function, `VariableElement#asPreparedType()`.\r\n\r\nThis fixes #397.","created_at":"2017-10-19T13:52:50Z","updated_at":"2017-11-01T04:51:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"786569d85d7daf278499499d8397e1be027b3349","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/398/commits","review_comments_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/398/comments","review_comment_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/comments{/number}","comments_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/398/comments","statuses_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/statuses/9c262856a65b83d8f8ad3bd9e3ebbe6cc694dc1c","head":{"label":"mannodermaus:nullable-params","ref":"nullable-params","sha":"9c262856a65b83d8f8ad3bd9e3ebbe6cc694dc1c","user":{"login":"mannodermaus","id":3897705,"avatar_url":"https://avatars2.githubusercontent.com/u/3897705?v=4","gravatar_id":"","url":"https://api.github.com/users/mannodermaus","html_url":"https://github.com/mannodermaus","followers_url":"https://api.github.com/users/mannodermaus/followers","following_url":"https://api.github.com/users/mannodermaus/following{/other_user}","gists_url":"https://api.github.com/users/mannodermaus/gists{/gist_id}","starred_url":"https://api.github.com/users/mannodermaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mannodermaus/subscriptions","organizations_url":"https://api.github.com/users/mannodermaus/orgs","repos_url":"https://api.github.com/users/mannodermaus/repos","events_url":"https://api.github.com/users/mannodermaus/events{/privacy}","received_events_url":"https://api.github.com/users/mannodermaus/received_events","type":"User","site_admin":false},"repo":{"id":41420054,"name":"PermissionsDispatcher","full_name":"mannodermaus/PermissionsDispatcher","owner":{"login":"mannodermaus","id":3897705,"avatar_url":"https://avatars2.githubusercontent.com/u/3897705?v=4","gravatar_id":"","url":"https://api.github.com/users/mannodermaus","html_url":"https://github.com/mannodermaus","followers_url":"https://api.github.com/users/mannodermaus/followers","following_url":"https://api.github.com/users/mannodermaus/following{/other_user}","gists_url":"https://api.github.com/users/mannodermaus/gists{/gist_id}","starred_url":"https://api.github.com/users/mannodermaus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mannodermaus/subscriptions","organizations_url":"https://api.github.com/users/mannodermaus/orgs","repos_url":"https://api.github.com/users/mannodermaus/repos","events_url":"https://api.github.com/users/mannodermaus/events{/privacy}","received_events_url":"https://api.github.com/users/mannodermaus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mannodermaus/PermissionsDispatcher","description":"Provides simple annotation-based API to handle runtime permissions in Marshmallow.","fork":true,"url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher","forks_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/forks","keys_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/teams","hooks_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/hooks","issue_events_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/issues/events{/number}","events_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/events","assignees_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/assignees{/user}","branches_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/branches{/branch}","tags_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/tags","blobs_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/statuses/{sha}","languages_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/languages","stargazers_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/stargazers","contributors_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/contributors","subscribers_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/subscribers","subscription_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/subscription","commits_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/contents/{+path}","compare_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/merges","archive_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/downloads","issues_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/issues{/number}","pulls_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/pulls{/number}","milestones_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/milestones{/number}","notifications_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/labels{/name}","releases_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/releases{/id}","deployments_url":"https://api.github.com/repos/mannodermaus/PermissionsDispatcher/deployments","created_at":"2015-08-26T10:38:37Z","updated_at":"2016-01-21T15:10:49Z","pushed_at":"2017-10-26T14:32:48Z","git_url":"git://github.com/mannodermaus/PermissionsDispatcher.git","ssh_url":"git@github.com:mannodermaus/PermissionsDispatcher.git","clone_url":"https://github.com/mannodermaus/PermissionsDispatcher.git","svn_url":"https://github.com/mannodermaus/PermissionsDispatcher","homepage":"http://hotchemi.github.io/PermissionsDispatcher","size":2440,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"permissions-dispatcher:master","ref":"master","sha":"0973ab3a6fb3ae8ff2788794ac1d46379c79b9fc","user":{"login":"permissions-dispatcher","id":31121294,"avatar_url":"https://avatars3.githubusercontent.com/u/31121294?v=4","gravatar_id":"","url":"https://api.github.com/users/permissions-dispatcher","html_url":"https://github.com/permissions-dispatcher","followers_url":"https://api.github.com/users/permissions-dispatcher/followers","following_url":"https://api.github.com/users/permissions-dispatcher/following{/other_user}","gists_url":"https://api.github.com/users/permissions-dispatcher/gists{/gist_id}","starred_url":"https://api.github.com/users/permissions-dispatcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/permissions-dispatcher/subscriptions","organizations_url":"https://api.github.com/users/permissions-dispatcher/orgs","repos_url":"https://api.github.com/users/permissions-dispatcher/repos","events_url":"https://api.github.com/users/permissions-dispatcher/events{/privacy}","received_events_url":"https://api.github.com/users/permissions-dispatcher/received_events","type":"Organization","site_admin":false},"repo":{"id":40786751,"name":"PermissionsDispatcher","full_name":"permissions-dispatcher/PermissionsDispatcher","owner":{"login":"permissions-dispatcher","id":31121294,"avatar_url":"https://avatars3.githubusercontent.com/u/31121294?v=4","gravatar_id":"","url":"https://api.github.com/users/permissions-dispatcher","html_url":"https://github.com/permissions-dispatcher","followers_url":"https://api.github.com/users/permissions-dispatcher/followers","following_url":"https://api.github.com/users/permissions-dispatcher/following{/other_user}","gists_url":"https://api.github.com/users/permissions-dispatcher/gists{/gist_id}","starred_url":"https://api.github.com/users/permissions-dispatcher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/permissions-dispatcher/subscriptions","organizations_url":"https://api.github.com/users/permissions-dispatcher/orgs","repos_url":"https://api.github.com/users/permissions-dispatcher/repos","events_url":"https://api.github.com/users/permissions-dispatcher/events{/privacy}","received_events_url":"https://api.github.com/users/permissions-dispatcher/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/permissions-dispatcher/PermissionsDispatcher","description":"Simple annotation-based API to handle runtime permissions.","fork":false,"url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher","forks_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/forks","keys_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/teams","hooks_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/hooks","issue_events_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/events{/number}","events_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/events","assignees_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/assignees{/user}","branches_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/branches{/branch}","tags_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/tags","blobs_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/statuses/{sha}","languages_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/languages","stargazers_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/stargazers","contributors_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/contributors","subscribers_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/subscribers","subscription_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/subscription","commits_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/contents/{+path}","compare_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/merges","archive_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/downloads","issues_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues{/number}","pulls_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls{/number}","milestones_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/milestones{/number}","notifications_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/labels{/name}","releases_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/releases{/id}","deployments_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/deployments","created_at":"2015-08-15T21:41:05Z","updated_at":"2017-11-01T02:39:30Z","pushed_at":"2017-11-01T03:38:34Z","git_url":"git://github.com/permissions-dispatcher/PermissionsDispatcher.git","ssh_url":"git@github.com:permissions-dispatcher/PermissionsDispatcher.git","clone_url":"https://github.com/permissions-dispatcher/PermissionsDispatcher.git","svn_url":"https://github.com/permissions-dispatcher/PermissionsDispatcher","homepage":"https://permissions-dispatcher.github.io/PermissionsDispatcher/","size":2420,"stargazers_count":5920,"watchers_count":5920,"language":"Java","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":899,"mirror_url":null,"archived":false,"open_issues_count":14,"forks":899,"open_issues":14,"watchers":5920,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/398"},"html":{"href":"https://github.com/permissions-dispatcher/PermissionsDispatcher/pull/398"},"issue":{"href":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/398"},"comments":{"href":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/398/comments"},"review_comments":{"href":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/398/comments"},"review_comment":{"href":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/pulls/398/commits"},"statuses":{"href":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/statuses/9c262856a65b83d8f8ad3bd9e3ebbe6cc694dc1c"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"mannodermaus"}}