In our project, we have is.effective as packageName. There are a model class Image located in is.effective.models package and some fragment with method foo, where Image is a parameter:
class ChatFragment: Fragment() {
...
@NeedsPermission(WRITE_EXTERNAL_STORAGE)
fun longClicked(image: Image) {
// method code is omitted
}
...
}
longClickedWithPermissionCheck extension method in ChatFragmentDispatcher.kt and generated code is compilable.longClickedWithPermissionCheck extension method in ChatFragmentDispatcher.kt, but generated code is not compilable, due to inproperly generated import statement (non-escaped is keyword):
Which library version are you using?
3.1.0
On which devices do you observe the issue?
that's a compilation error
Note any other information that might be useful
As I understand, PermissionDispatcher relies on https://github.com/square/kotlinpoet, so we need to address the issue their. I went ahead, forked kotlinpoet, made a local fix and will submit PR to kotlinpoet shortly.
Huh, I'm certain that I did that before (edit: yes I did). @shiraji, @hotchemi, let's review the version of kotlinpoet we're pulling in with the latest version of PermissionsDispatcher. @AlexKorovyansky, can you try adding an explicit dependency on the latest kotlinpoet to the annotationProcessor configuration and see if that helps?
We need to wait https://github.com/square/kotlinpoet/pull/327 release. Right? @AlexKorovyansky
I see, this actually is somehow different to our previous work - weird. Admittedly, I only skimmed over the related kotlinpoet issue briefly. Okay, let's wait on a new release then!
Original PR (https://github.com/square/kotlinpoet/pull/248) fixed only an issue with package declaration, while this issue relates to imports. The fix for kotlinpoet has been already merged to master and should be available in 0.8.0-SNAPSHOT. Is there any option to use kotlinpoet 0.8.0-SNAPSHOT with the latest version of PermissionsDispatcher?
Oh I found with 0.8.0-SNAPSHOT generated kt class causes a compile error as below 馃
(PermissionUtils.hasSelfPermissions(`this`, *PERMISSION_SHOWCAMERA))
Updated KotlinPoet to 1.0.0-RC.
Most helpful comment
Original PR (https://github.com/square/kotlinpoet/pull/248) fixed only an issue with package declaration, while this issue relates to imports. The fix for kotlinpoet has been already merged to master and should be available in 0.8.0-SNAPSHOT. Is there any option to use kotlinpoet 0.8.0-SNAPSHOT with the latest version of PermissionsDispatcher?