{"action":"created","issue":{"url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/503","repository_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher","labels_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/503/labels{/name}","comments_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/503/comments","events_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/503/events","html_url":"https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/503","id":343312603,"node_id":"MDU6SXNzdWUzNDMzMTI2MDM=","number":503,"title":"Kotlin generation doesn't handle ()->Unit.","user":{"login":"shiehnpin","id":6296986,"node_id":"MDQ6VXNlcjYyOTY5ODY=","avatar_url":"https://avatars3.githubusercontent.com/u/6296986?v=4","gravatar_id":"","url":"https://api.github.com/users/shiehnpin","html_url":"https://github.com/shiehnpin","followers_url":"https://api.github.com/users/shiehnpin/followers","following_url":"https://api.github.com/users/shiehnpin/following{/other_user}","gists_url":"https://api.github.com/users/shiehnpin/gists{/gist_id}","starred_url":"https://api.github.com/users/shiehnpin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shiehnpin/subscriptions","organizations_url":"https://api.github.com/users/shiehnpin/orgs","repos_url":"https://api.github.com/users/shiehnpin/repos","events_url":"https://api.github.com/users/shiehnpin/events{/privacy}","received_events_url":"https://api.github.com/users/shiehnpin/received_events","type":"User","site_admin":false},"labels":[{"id":1148538972,"node_id":"MDU6TGFiZWwxMTQ4NTM4OTcy","url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/labels/kotlinpoet","name":"kotlinpoet","color":"e8a25c","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-07-21T09:17:25Z","updated_at":"2018-12-12T08:05:41Z","closed_at":null,"author_association":"NONE","body":"## FAQs\r\n\r\n<!--\r\nBefore you add the issue, please make sure to read over the following Frequently Asked Questions:\r\n\r\n**\"XxxPermissionsDispatcher class is not generated\"**\r\n\r\n- Did you add `@RuntimePermissions` to your class, and `@NeedsPermission` to your method?\r\n- Did you try a Rebuild? (Sync is not Rebuild!)\r\n- Don't mix `apt` and `annotationProcessor`!\r\n- If you're in Kotlin, use `kapt`!\r\n- If you're using Realm 1.x., please consider upgrading to 2.x (refer to Issue #270: https://github.com/hotchemi/PermissionsDispatcher/issues/270)\r\n- If you checked all these steps, and the generated classes are still not showing up, then attach your Activity/Fragment class, and build.gradle.\r\n-->\r\n \r\n___\r\n\r\n## Overview\r\n\r\n```kotlin\r\n@NeedsPermission(Manifest.permission.CAMERA)\r\nfun test(f:()->Unit){\r\n    f.invoke()\r\n}\r\n```\r\n\r\n### Expected\r\n\r\nSuccessfully rebuild and generate code to be invoked like this:\r\n```kotlin\r\nfun Activity.testWithPermissionCheck(f:()->Unit) {\r\n…\r\n}\r\n```\r\n\r\n### Actual\r\n\r\nI can't rebuild project and get following error:\r\n\r\n`Type mismatch: inferred type is kotlin.jvm.functions.Function0<Unit> but () -> Unit was expected`\r\n\r\n```kotlin\r\nfun MainActivity.testWithPermissionCheck(f: Function0<Unit>) {\r\n  if (PermissionUtils.hasSelfPermissions(this, *PERMISSION_TEST)) {\r\n    test(f)\r\n  } else {\r\n    PENDING_TEST = MainActivityTestPermissionRequest(this, f)\r\n    ActivityCompat.requestPermissions(this, PERMISSION_TEST, REQUEST_TEST)\r\n  }\r\n}\r\n```\r\n\r\n```kotlin\r\nprivate class MainActivityTestPermissionRequest(target: MainActivity, private val f: Function0<Unit>) : GrantableRequest {\r\n  private val weakTarget: WeakReference<MainActivity> = WeakReference(target)\r\n\r\n  override fun proceed() {\r\n    val target = weakTarget.get() ?: return\r\n    ActivityCompat.requestPermissions(target, PERMISSION_TEST, REQUEST_TEST)\r\n  }\r\n\r\n  override fun cancel() {\r\n  }\r\n\r\n  override fun grant() {\r\n    val target = weakTarget.get() ?: return\r\n    target.test(f)\r\n  }\r\n}\r\n```\r\n\r\n## Environment\r\n\r\n`4.0.0-alpha`\r\n"},"comment":{"url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/comments/446497393","html_url":"https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/503#issuecomment-446497393","issue_url":"https://api.github.com/repos/permissions-dispatcher/PermissionsDispatcher/issues/503","id":446497393,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NjQ5NzM5Mw==","user":{"login":"hotchemi","id":471318,"node_id":"MDQ6VXNlcjQ3MTMxOA==","avatar_url":"https://avatars3.githubusercontent.com/u/471318?v=4","gravatar_id":"","url":"https://api.github.com/users/hotchemi","html_url":"https://github.com/hotchemi","followers_url":"https://api.github.com/users/hotchemi/followers","following_url":"https://api.github.com/users/hotchemi/following{/other_user}","gists_url":"https://api.github.com/users/hotchemi/gists{/gist_id}","starred_url":"https://api.github.com/users/hotchemi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hotchemi/subscriptions","organizations_url":"https://api.github.com/users/hotchemi/orgs","repos_url":"https://api.github.com/users/hotchemi/repos","events_url":"https://api.github.com/users/hotchemi/events{/privacy}","received_events_url":"https://api.github.com/users/hotchemi/received_events","type":"User","site_admin":false},"created_at":"2018-12-12T08:05:41Z","updated_at":"2018-12-12T08:05:41Z","author_association":"MEMBER","body":"Updated kotlinpoet to 1.0.0 but the issue hasn't been addressed🤔"}}
{"actor":{"display_login":"hotchemi"}}