Strange M7 error



I upgraded one of my projects to kotlin M7. The project is a rest api running with tomcat+spring MVC.

The following code

fun mensualitesPourEcheances(data: SimPretDeviseData, tauxReferences:List<TauxReference>):List<MensualiteParEcheance> {   return { MensualiteParEcheance(it.echeance, 1000, 1001, 1002) }.sortBy { it.echeance } }

produces the error :

Grave: Servlet.service() for servlet [mvc-dispatcher] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: kotlin.KotlinPackage.toArrayList(Ljava/lang/Iterable;)Ljava/util/ArrayList;] with root cause java.lang.NoSuchMethodError: kotlin.KotlinPackage.toArrayList(Ljava/lang/Iterable;)Ljava/util/ArrayList;      at com.mcf.back.BackPackage-LoanServiceController-46737643.mensualitesPourEcheances(LoanServiceController.kt:42)      at com.mcf.back.LoanServiceController.evaluerPret(LoanServiceController.kt:35)      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)      at sun.reflect.NativeMethodAccessorImpl.invoke(      at sun.reflect.DelegatingMethodAccessorImpl.invoke(      at java.lang.reflect.Method.invoke(      at      at      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(      at org.springframework.web.servlet.DispatcherServlet.doDispatch(

But if I run the same code from a unit test, I have no problem.

Do you have any idea of what the problem can be?


Can it be that you server has an old version of kotlin-runtime.jar?

Otherwise, try to diable inlining ( Does it help?


Yes!! That was the problem.

I had changed the kotlin version in the pom but the old version was still in the generated artefact (I only did a build where I should have done a rebuild project).

Thanks a lot,