Is it a kotlin bug if a non nullable class constru...
# multiplatform
r
Is it a kotlin bug if a non nullable class constructor parameter is null at
init {...}
? If I make it wait for ex. 1 second with coroutines it works and the value is not null. The parameter is immutable. the problem is with my
blockingRules
parameter:
Copy code
class BasicConsoleLogger(
    val blockingRules: BlockingRulesConfigurationScope.() -> Unit = {}
) : Logger(<http://LogLevel.Info|LogLevel.Info>) { ... }
the link to the full file together with classes in the repo that it's using here -> https://github.com/libki-kt/LOGik/blob/main/Behaviour/ConsoleLoggingBehaviour/src/[…]lin/org/duckdns/libki/LOGik/consoleLogger/BasicConsoleLogger.kt *the current code runs but if you remove the delay invokations and the launch {} from
Logger
class then the error appears(NPE)
e
https://youtrack.jetbrains.com/issue/KT-10573/Read-of-uninitialized-property-in-constructor-fragile-constructors tl;dr it's an issue with Java-style initialization that Kotlin can't fix without breaking compatibility