Internal compiler errors in Kotlin 1.1.3


#1

I first noticed this last Friday, when I installed IntelliJ 2017.2 Public Preview, which contains Kotlin 1.1.3-85-eap… And unfortunately I didn’t realise then, how close to release this version was, and had reported only one via the IDE exception reporting mechanism.

The Kotlin compiler 1.1.3 gives me 2 different internal compiler errors on the code of my project, at least when building using the IDE-native plugin compiler.

One of the exceptions points to a specific line of code which has so far been legal Kotlin code in all versions of Kotlin 1.0 and 1.1 that I’ve used on this project:

@Entity
class AuthenticationConfiguration(
    tokenExpiresIn: Long
    .... ) {
    ....
    @Column
    var tokenExpiryDate: ZonedDateTime

    init {
        tokenExpiryDate = ZonedDateTime.now() + Duration.ofSeconds(tokenExpiresIn - 10L)
    }
....
}

The problem is with the line in the init {} block; I’ve removed the rest of the class as it didn’t seem relevant to the context.

The exception message is:

Error:Kotlin: [Internal Error] org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Don't know how to generate outer expression for class AuthenticationConfiguration
Cause: Don't know how to generate outer expression for class AuthenticationConfiguration
File being compiled and position: (43,68) in D:/Dev/l1nda/gig-marketplace/temper-bridge/src/main/kotlin/nl/l1nda/jobmp/integrations/temper/model/AuthenticationConfiguration.kt
PsiElement: tokenExpiresIn
The root cause was thrown at: CodegenContext.java:218

The second internal compiler error doesn’t have a line number attached but is a ClassCastException.

I have attached the full stacktraces of both excpetions.

Since these errors are blocking for the project and the IDE plugin has already been updated I wonder if there’s a way to downgrade to the Kotlin 1.1.2 plugin version until both these issues have been resolved?

–Tim

kotlin-1.1.3-ice-code-generation-exception.txt.7z (2.0 KB)
kotlin-1.1.3-ice-classcast-exception.txt.7z (1.5 KB)


#2

I’ve raised issues for both problems in YouTrack:

https://youtrack.jetbrains.com/issue/KT-18667

https://youtrack.jetbrains.com/issue/KT-18668


#3

I have the same two issues in my project. After updating the Intellij Kotlin plugin to 1.1.3 I started getting the exception from KT-18667. I tried updating the project to 1.1.3 and fixing the other compile errors I was then getting (same as in KT-18668). Then the project built with maven successfully but in Intellij I still got the first exception.

What actually helped was to uninstall the Kotlin plugin and after an Intellij restart i had the 1.1.2 version again - I don’t know how that actually worked, but now Intellij is usable again.


#4

Thanks, I’ll try that too! Because for me right now, not being able to run or debug from IntelliJ is a pretty big nuisance.


#5

Fortunately, removing the Kotlin plugin indeed worked. IntelliJ reverted to the version that was delivered with it and now my system works properly again.