Kotlin 1.2.40 compatibility issue with Dropwizard/Jersey


I have a web server project based on Dropwizard 1.3.1 (which internally uses the Jersey RESTful Web Services framework) and Kotlin 1.2.31. All application code is implemented with Kotlin.

After upgrading the Kotlin plugin to version 1.2.40 I started seeing lots of fatal runtime errors when the app starts up and Jersey attempts to load the resource classes. Here is one of the many fatal errors (I have reformatted the message for easier reading):

[FATAL] A resource model has ambiguous (sub-)resource method for HTTP method POST and input mime-types as defined by"@Consumes" and “@Produces” annotations at Java methods
public final com.aia.pathfinder.model.PxDocument$Json com.aia.pathfinder.api.PxApiDocuments.postDoc(
public static com.aia.pathfinder.model.PxDocument$Json com.aia.pathfinder.api.PxApiDocuments.postDoc$default(
at matching regular expression /api/proj/([^/]+)/docs. These two methods produces and consumes exactly the same mime-types and therefore their invocation as a resource methods will always fail.; source=‘org.glassfish.jersey.server.model.RuntimeResource@4ebed2b3’]

The problem is that there are two methods with the annotations:

So Jersey doesn’t know which method to use.

This problem appeared after upgrading to Kotlin 1.2.40, and it went away after reverting to Kotlin 1.2.31. My guess is the the static $default version of the method (which is being generated by the Kotlin compiler) is a new thing in version 1.2.40.

Is there a compiler flag that I can use to revert to the previous compiler output, or some other way to resolve the problem?