Help: kotlin method generation problem in JAX-RS


#1

Given an service method:

 
@Consumes( "application/json" ,"text/json")
@Produces( "application/json" , "text/json")
 
@Get
 
@Path("/")
 
fun findAll():Result{
 
 ....
 
}

it seems that an additional method findAll$default is generated by compiler , thus causes SEVERE error :

SEVERE: Consuming media type conflict. The resource methods public static Result AService.findAll$default(AService) and public final Result AService.findAll() can consume the same media type.

It’s running with kotlin 0.12.1218 and jersey 0.19.

I don’t know how to resolve it  :(

thanks

outersky


#2

$default suffix means that you have default values for function parameters. You shouldn't use them with JAX-RS because kotlin compiler produces a bunch of Java methods with same names and annotations set so this makes JAX-RS panic


#3

I thought it would not generate without jvmOverloads being specified. Thanks.

outersky