# Kotlin 1.4 not work when compile in Spring Boot 2.3.0 and Gradle 6.4.1

**URL:** <https://discuss.kotlinlang.org/t/kotlin-1-4-not-work-when-compile-in-spring-boot-2-3-0-and-gradle-6-4-1/18849>\
**Category:** Support\
**Created:** [August 20, 2020, 5:07am UTC](https://discuss.kotlinlang.org/t/kotlin-1-4-not-work-when-compile-in-spring-boot-2-3-0-and-gradle-6-4-1/18849 "2020-08-20T05:07:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sombochea](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sombochea/32/7045_2.png) [@sombochea](https://discuss.kotlinlang.org/u/sombochea)\
**Post date:** [August 20, 2020, 5:07am UTC](https://discuss.kotlinlang.org/t/kotlin-1-4-not-work-when-compile-in-spring-boot-2-3-0-and-gradle-6-4-1/18849/1 "2020-08-20T05:07:58Z")

</div>

When compile it’s spent a long time than error

> Task :compileKotlin FAILED  
> e: org.jetbrains.kotlin.util.KotlinFrontEndException: Exception while analyzing expression at (226,17) in /home/sombochea/projects/clinical/src/main/java/com/cubetiqs/clinical/infrastructure/service/system/impl/TranslateServiceImpl.kt  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.logOrThrowException(ExpressionTypingVisitorDispatcher.java:253)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:224)  
> at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:134)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitExpression(ExpressionTypingVisitorForStatements.java:387)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitExpression(ExpressionTypingVisitorForStatements.java:65)  
> at org.jetbrains.kotlin.psi.KtVisitor.visitReferenceExpression(KtVisitor.java:198)  
> at org.jetbrains.kotlin.psi.KtVisitor.visitCallExpression(KtVisitor.java:278)  
> at org.jetbrains.kotlin.psi.KtCallExpression.accept(KtCallExpression.java:35)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)  
> at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:147)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getBlockReturnedTypeWithWritableScope(ExpressionTypingServices.java:334)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getBlockReturnedType(ExpressionTypingServices.java:200)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getBlockReturnedType(ExpressionTypingServices.java:177)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitBlockExpression(ExpressionTypingVisitorForStatements.java:430)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitBlockExpression(ExpressionTypingVisitorForStatements.java:65)  
> at org.jetbrains.kotlin.psi.KtBlockExpression.accept(KtBlockExpression.java:78)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)  
> at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:147)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getTypeOfLastExpressionInBlock(ExpressionTypingServices.java:395)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getBlockReturnedTypeWithWritableScope(ExpressionTypingServices.java:320)  
> at org.jetbrains.kotlin.types.expressions.ControlStructureTypingVisitor.getTypeInfoWhenOnlyOneBranchIsPresent(ControlStructureTypingVisitor.java:220)  
> at org.jetbrains.kotlin.types.expressions.ControlStructureTypingVisitor.visitIfExpression(ControlStructureTypingVisitor.java:101)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitIfExpression(ExpressionTypingVisitorForStatements.java:420)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitIfExpression(ExpressionTypingVisitorForStatements.java:65)  
> at org.jetbrains.kotlin.psi.KtIfExpression.accept(KtIfExpression.java:33)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)  
> at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:147)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getTypeOfLastExpressionInBlock(ExpressionTypingServices.java:395)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getBlockReturnedTypeWithWritableScope(ExpressionTypingServices.java:320)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getBlockReturnedType(ExpressionTypingServices.java:200)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getBlockReturnedType(ExpressionTypingServices.java:177)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitBlockExpression(ExpressionTypingVisitorForStatements.java:430)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitBlockExpression(ExpressionTypingVisitorForStatements.java:65)  
> at org.jetbrains.kotlin.psi.KtBlockExpression.accept(KtBlockExpression.java:78)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)  
> at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:147)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getTypeOfLastExpressionInBlock(ExpressionTypingServices.java:395)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getBlockReturnedTypeWithWritableScope(ExpressionTypingServices.java:320)  
> at org.jetbrains.kotlin.types.expressions.ControlStructureTypingVisitor.getTypeInfoWhenOnlyOneBranchIsPresent(ControlStructureTypingVisitor.java:220)  
> at org.jetbrains.kotlin.types.expressions.ControlStructureTypingVisitor.visitIfExpression(ControlStructureTypingVisitor.java:101)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitIfExpression(ExpressionTypingVisitorForStatements.java:420)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitIfExpression(ExpressionTypingVisitorForStatements.java:65)  
> at org.jetbrains.kotlin.psi.KtIfExpression.accept(KtIfExpression.java:33)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)  
> at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:147)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getBlockReturnedTypeWithWritableScope(ExpressionTypingServices.java:334)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getBlockReturnedType(ExpressionTypingServices.java:200)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getBlockReturnedType(ExpressionTypingServices.java:177)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitBlockExpression(ExpressionTypingVisitorForStatements.java:430)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorForStatements.visitBlockExpression(ExpressionTypingVisitorForStatements.java:65)  
> at org.jetbrains.kotlin.psi.KtBlockExpression.accept(KtBlockExpression.java:78)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)  
> at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:147)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.checkFunctionReturnType(ExpressionTypingServices.java:172)  
> at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.checkFunctionReturnType(ExpressionTypingServices.java:155)  
> at org.jetbrains.kotlin.resolve.BodyResolver.resolveFunctionBody(BodyResolver.java:985)  
> at org.jetbrains.kotlin.resolve.BodyResolver.resolveFunctionBody(BodyResolver.java:932)  
> at org.jetbrains.kotlin.resolve.BodyResolver.resolveFunctionBodies(BodyResolver.java:918)  
> at org.jetbrains.kotlin.resolve.BodyResolver.resolveBehaviorDeclarationBodies(BodyResolver.java:125)  
> at org.jetbrains.kotlin.resolve.BodyResolver.resolveBodies(BodyResolver.java:246)  
> at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations(LazyTopDownAnalyzer.kt:225)  
> at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations$default(LazyTopDownAnalyzer.kt:60)  
> at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:123)  
> at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:93)  
> at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:526)  
> at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:90)  
> at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:115)  
> at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:517)  
> at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:185)  
> at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:164)  
> at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:51)  
> at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:86)  
> at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)  
> at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)  
> at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:346)  
> at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:102)  
> at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:240)  
> at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:39)  
> at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:81)  
> at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:93)  
> at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:601)  
> at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:93)  
> at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1633)  
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
> at java.lang.reflect.Method.invoke(Method.java:498)  
> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)  
> at sun.rmi.transport.Transport$1.run(Transport.java:200)  
> at sun.rmi.transport.Transport$1.run(Transport.java:197)  
> at java.security.AccessController.doPrivileged(Native Method)  
> at sun.rmi.transport.Transport.serviceCall(Transport.java:196)  
> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)  
> at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)  
> at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)  
> at java.security.AccessController.doPrivileged(Native Method)  
> at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)  
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
> at java.lang.Thread.run(Thread.java:748)  
> Caused by: java.lang.OutOfMemoryError: Java heap space

---

<div class="post-metadata">

**Author:** ![Alexey.Belkov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/alexey.belkov/32/5215_2.png) [@Alexey.Belkov](https://discuss.kotlinlang.org/u/Alexey.Belkov)\
**Post date:** [August 20, 2020, 9:36am UTC](https://discuss.kotlinlang.org/t/kotlin-1-4-not-work-when-compile-in-spring-boot-2-3-0-and-gradle-6-4-1/18849/2 "2020-08-20T09:36:29Z")

</div>

Does it help to turn off new inference?

```auto
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
  kotlinOptions {
    freeCompilerArgs += ["-XXLanguage:-NewInference"]
  }
}

```

Can you please file an issue at [http://kotl.in/issue](http://kotl.in/issue) with some sample project to reproduce, so we can fix the bug?

---

<div class="post-metadata">

**Author:** ![sombochea](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sombochea/32/7045_2.png) [@sombochea](https://discuss.kotlinlang.org/u/sombochea)\
**Post date:** [August 21, 2020, 2:47am UTC](https://discuss.kotlinlang.org/t/kotlin-1-4-not-work-when-compile-in-spring-boot-2-3-0-and-gradle-6-4-1/18849/3 "2020-08-21T02:47:37Z")

</div>

I added the compile args below,

![image](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/4/4b58c228ceb57baed797bbab309062bb8f5c24d1.png)

The compiler for successfully compiled and built.  
And one more, I was created new project that no need to use **‘-XXLanguage:-NewInference’**. And it no matter too for build and fast than old version of kotlin.

As that, it can cause on my legacy code in my old project or something else?

Thank you.

---

<div class="post-metadata">

**Author:** ![Alexey.Belkov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/alexey.belkov/32/5215_2.png) [@Alexey.Belkov](https://discuss.kotlinlang.org/u/Alexey.Belkov)\
**Post date:** [August 21, 2020, 1:41pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-4-not-work-when-compile-in-spring-boot-2-3-0-and-gradle-6-4-1/18849/4 "2020-08-21T13:41:09Z")

</div>

Ok, so it is a performance problem with new inference on your specific code pattern. It would be very helpful if you create an issue at [http://kotl.in/issue](http://kotl.in/issue) with a sample project to reproduce (can be attached privately) so we can diagnose and fix the problem.

---

<div class="post-metadata">

**Author:** ![sombochea](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sombochea/32/7045_2.png) [@sombochea](https://discuss.kotlinlang.org/u/sombochea)\
**Post date:** [August 23, 2020, 12:16pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-4-not-work-when-compile-in-spring-boot-2-3-0-and-gradle-6-4-1/18849/5 "2020-08-23T12:16:38Z")

</div>

Yeah, thank you!

---

<div class="post-metadata">

**Author:** ![aleksey.choice](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@aleksey.choice](https://discuss.kotlinlang.org/u/aleksey.choice)\
**Post date:** [September 9, 2020, 5:12pm UTC](https://discuss.kotlinlang.org/t/kotlin-1-4-not-work-when-compile-in-spring-boot-2-3-0-and-gradle-6-4-1/18849/6 "2020-09-09T17:12:07Z")

</div>

Is there any updates for this topic ? or link for created issue ? Recently I faced the same stacktrace while running tests using intelij idea launcher(testng) . but in case if I use gradle launcher for running same tests then no errors appear.

---

<div class="post-metadata">

**Author:** ![Alexey.Belkov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/alexey.belkov/32/5215_2.png) [@Alexey.Belkov](https://discuss.kotlinlang.org/u/Alexey.Belkov)\
**Post date:** [September 10, 2020, 7:30am UTC](https://discuss.kotlinlang.org/t/kotlin-1-4-not-work-when-compile-in-spring-boot-2-3-0-and-gradle-6-4-1/18849/7 "2020-09-10T07:30:27Z")

</div>

This may be a different problem. It would be helpful if you created an issue on YouTrack with a sample project to reproduce.

---

<div class="post-metadata">

**Author:** ![imanushin](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/imanushin/32/5471_2.png) [@imanushin](https://discuss.kotlinlang.org/u/imanushin)\
**Post date:** [September 10, 2020, 8:33am UTC](https://discuss.kotlinlang.org/t/kotlin-1-4-not-work-when-compile-in-spring-boot-2-3-0-and-gradle-6-4-1/18849/8 "2020-09-10T08:33:59Z")

</div>

As workaround, I can advice updating to 2.3.3-RELEASE and 6.6.1 versions. We don’t have any issues (except [runtime version warning](https://discuss.kotlinlang.org/t/gradle-6-6-1-and-kotlin-1-4-runtime-version-conflict/18987)) there.
