permissions-dispatcher / PermissionsDispatcher

A declarative API to handle Android runtime permissions.
https://github.com/permissions-dispatcher/PermissionsDispatcher
Apache License 2.0
11.22k stars 1.44k forks source link

IllegalArgumentException with annotation after updating to Kotlin 1.6.10 #771

Closed Morrodin closed 2 years ago

Morrodin commented 2 years ago

Overview

Recently we updated our project to use Kotlin 1.6.10 from 1.4.x in order to support some other changes. After this change was made, Kotlin files using the PermissionsDispatcher annotations throw IllegalArgumentExceptions when trying to compile:

Caused by: java.lang.IllegalArgumentException: Can't escape identifier arrayOf("android.permission.READ_EXTERNAL_STORAGE") because it contains illegal characters: .

This is for the following annotations: @NeedsPermission(Manifest.permission.READ_EXTERNAL_STORAGE) @OnShowRationale(Manifest.permission.READ_EXTERNAL_STORAGE) @OnPermissionDenied(Manifest.permission.READ_EXTERNAL_STORAGE)

The same exact annotations compile fine across Java files where we use them. I'm positive it's these annotations, since commenting out any of the PermissionsDispatcher code references in this one class will allow the app to compile (although not function for this case).

Expected

Kotlin files using PermissionsDispatcher will compile.

Actual

An IllegalArgumentException is thrown for the PermissionsDispatcher annotations in Kotlin files.

Environment

- Which library version are you using?

implementation 'com.github.hotchemi:permissionsdispatcher:3.3.1'
kapt 'com.github.hotchemi:permissionsdispatcher-processor:3.3.1'

- On which devices do you observe the issue? All, physical and emulators.

Morrodin commented 2 years ago

Realized we were very out of date. Updating library and working through that.

hotchemi commented 2 years ago

Thx, if newer versions work for you let us close the issue👍