Strange M7 error

Hi,

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 tauxReferences.map { 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(NativeMethodAccessorImpl.java:57)      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)      at java.lang.reflect.Method.invoke(Method.java:606)      at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:746)      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:687)      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)

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 (http://blog.jetbrains.com/kotlin/2014/03/m7-release-available/). 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,