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

Nullable params have wrong type with Kotlin #603

Closed m-i-k-e-e closed 5 years ago

m-i-k-e-e commented 5 years ago

FAQs


Overview

Hello,

It looks like Nullable Double parameters are wrongly resolved.

Expected

Parameters to be resolved as kotlin.Double?

fun setupMap(zoomLevel: Double, latitude: Double?, longitude: Double) fun TrackedMapFragment.setupMapWithPermissionCheck( zoomLevel: Double,latitude: Double?, longitude: Double)

Actual

Parameters are resolved as java.lang.Double?

fun setupMap(zoomLevel: Double, latitude: Double?, longitude: Double) fun TrackedMapFragment.setupMapWithPermissionCheck( zoomLevel: Double, latitude: java.lang.Double?, longitude: Double )

Environment

kapt "org.permissionsdispatcher:permissionsdispatcher-processor:4.3.0" implementation 'org.permissionsdispatcher:permissionsdispatcher:4.3.0'

hotchemi commented 5 years ago

Thx for your report. Can I suppose the problem here is Double? is converted to java.lang.Double?, am I correct?

m-i-k-e-e commented 5 years ago

Exactly. It creates errors at compile time as for some reasons, Kotlin.Double is not the same as Java.lang.Double. But it only happens with nullable values

hotchemi commented 5 years ago

I see. I think this is due to KotlinPoet.. 🤔

alifhasnain commented 2 years ago

Still having an issue with nullable Long type. Generated code is using java.lang.Long instead ofkotlin.Long.