Retrofit: Parameter type must not include a type variable or wildcard: java.util.Map<java.lang.String, ?>

Created on 3 Jan 2020  Â·  2Comments  Â·  Source: square/retrofit

@POST("/driver/login")
suspend fun login(@Body param:Map<String,Any>): Result<String>

ex:
{ var param= mapOf( "password" to "123123", "phone" to "123456789") service.login(param) }

use Map when use it case Throwable
throwabel is < java.lang.IllegalArgumentException: Parameter type must not include a type variable or wildcard: java.util.Map (parameter #1) >

Most helpful comment

For now you should be able to add @JvmSuppressWildcard to the parameter to
work around the issue. I'll see about relaxing the restrictions.

On Fri, Jan 3, 2020 at 4:30 AM jikun2008 notifications@github.com wrote:

@POST("/driver/login")
suspend fun login(@Body param:Map): Result

ex:
{ var param= mapOf( "password" to "123123", "phone" to "123456789")
service.login(param) }

use Map when use it case Throwable
throwabel is < java.lang.IllegalArgumentException: Parameter type must not
include a type variable or wildcard: java.util.Map
(parameter #1 https://github.com/square/retrofit/issues/1) >

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/square/retrofit/issues/3275?email_source=notifications&email_token=AAAQIEMBV27JCN6MALWKWMTQ34ASPA5CNFSM4KCLLQ7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ID2YAZA,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAQIEI63FNK4I6JUNVFDWLQ34ASPANCNFSM4KCLLQ7A
.

All 2 comments

For now you should be able to add @JvmSuppressWildcard to the parameter to
work around the issue. I'll see about relaxing the restrictions.

On Fri, Jan 3, 2020 at 4:30 AM jikun2008 notifications@github.com wrote:

@POST("/driver/login")
suspend fun login(@Body param:Map): Result

ex:
{ var param= mapOf( "password" to "123123", "phone" to "123456789")
service.login(param) }

use Map when use it case Throwable
throwabel is < java.lang.IllegalArgumentException: Parameter type must not
include a type variable or wildcard: java.util.Map
(parameter #1 https://github.com/square/retrofit/issues/1) >

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/square/retrofit/issues/3275?email_source=notifications&email_token=AAAQIEMBV27JCN6MALWKWMTQ34ASPA5CNFSM4KCLLQ7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ID2YAZA,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAQIEI63FNK4I6JUNVFDWLQ34ASPANCNFSM4KCLLQ7A
.

*@JvmSuppressWildcards

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chriskessel picture chriskessel  Â·  3Comments

jpshelley picture jpshelley  Â·  4Comments

ramonmoraes8080 picture ramonmoraes8080  Â·  3Comments

zheangrybear picture zheangrybear  Â·  3Comments

starktonys picture starktonys  Â·  3Comments