Clean-up warnings

This commit is contained in:
Edwin Jakobs
2024-03-16 09:11:37 +01:00
parent c01d49861b
commit 8f2d382093
15 changed files with 57 additions and 26 deletions

View File

@@ -136,7 +136,7 @@ class Olive<P : Program>(val resources: Resources? = null, private var scriptMod
watcher = watchFile(File(script), requestStopEvent = watcherRequestStopEvent) {
try {
logger.info("change detected, reloading script")
logger.info { "change detected, reloading script" }
val scriptContents = when (scriptMode) {
ScriptMode.KOTLIN_SCRIPT -> it.readText()

View File

@@ -22,8 +22,10 @@ fun clearReloadables() {
*/
open class Reloadable {
private fun normalizeClassName(name: String): String {
return name.replace(Regex("ScriptingHost[0-9a-f]+_"), // -- since kotlin 1.3.61 the scripting host prepends class names with the host id
"").replace(Regex("Line_[0-9]+"),"") // -- when reusing the script engine the line number increments.
return name.replace(
Regex("ScriptingHost[0-9a-f]+_"), // -- since kotlin 1.3.61 the scripting host prepends class names with the host id
""
).replace(Regex("Line_[0-9]+"), "") // -- when reusing the script engine the line number increments.
}
/**
@@ -41,14 +43,14 @@ open class Reloadable {
val value = (e as KProperty1<Any, Any?>).get(existing)
val mp = (p as KMutableProperty1<Any, Any?>)
mp.set(this, value as Any)
logger.info("reloaded property ${p.name} <- ${value}")
logger.info { "reloaded property ${p.name} <- ${value}" }
} catch (e: Throwable) {
logger.warn("error while reloading property ${p.name}: ${e.message}")
logger.warn { "error while reloading property ${p.name}: ${e.message}" }
}
}
}
} else {
logger.info("no existing store found for $className")
logger.info { "no existing store found for $className" }
}
store[normalizeClassName(this::class.jvmName)] = this
}