From 9b5d12203f44b52b471d6c69be176f304b00a1a5 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Fri, 13 Dec 2024 18:31:17 +0100 Subject: [PATCH] Make private secondary constructors the primaries --- .../kotlin/de/staropensource/engine/base/Engine.kt | 9 +-------- .../de/staropensource/engine/newsubprj/Example.kt | 13 ++++++------- .../de/staropensource/engine/logging/Filterer.kt | 9 +-------- .../engine/logging/LoggerConfiguration.kt | 9 +-------- .../de/staropensource/engine/logging/Processor.kt | 9 +-------- .../kotlin/de/staropensource/engine/testapp/Main.kt | 9 +-------- 6 files changed, 11 insertions(+), 47 deletions(-) diff --git a/base/src/main/kotlin/de/staropensource/engine/base/Engine.kt b/base/src/main/kotlin/de/staropensource/engine/base/Engine.kt index cc1e4809b..8a4bed347 100644 --- a/base/src/main/kotlin/de/staropensource/engine/base/Engine.kt +++ b/base/src/main/kotlin/de/staropensource/engine/base/Engine.kt @@ -30,7 +30,7 @@ import de.staropensource.engine.logging.Logger * * @since v1-alpha10 */ -class Engine { +class Engine private constructor() { /** * Companion class of [Engine]. * @@ -47,11 +47,4 @@ class Engine { Logger.instance.info("Initializing") } } - - /** - * Initializes this class. - * - * @since v1-alpha10 - */ - private constructor() } diff --git a/dist/template-subproject/src/main/kotlin/de/staropensource/engine/newsubprj/Example.kt b/dist/template-subproject/src/main/kotlin/de/staropensource/engine/newsubprj/Example.kt index 7d2e34085..c9b9c617e 100644 --- a/dist/template-subproject/src/main/kotlin/de/staropensource/engine/newsubprj/Example.kt +++ b/dist/template-subproject/src/main/kotlin/de/staropensource/engine/newsubprj/Example.kt @@ -20,11 +20,10 @@ package de.staropensource.engine.newsubprj; -class Example { - /** - * Initializes this class. - * - * @since v1-alpha10 - */ - private constructor() +/** + * An example class. + * + * @since v1-alpha10 + */ +class Example private constructor() { } diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/Filterer.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/Filterer.kt index 6f90d290d..c194d00c5 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/Filterer.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/Filterer.kt @@ -28,7 +28,7 @@ import de.staropensource.engine.logging.type.Call * * @since v1-alpha10 */ -class Filterer { +class Filterer private constructor() { /** * Companion object of [Filterer] * @@ -60,11 +60,4 @@ class Filterer { return false } } - - /** - * Initializes this class. - * - * @since v1-alpha10 - */ - private constructor() } diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/LoggerConfiguration.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/LoggerConfiguration.kt index 4881fcc9a..14a5fd2cb 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/LoggerConfiguration.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/LoggerConfiguration.kt @@ -34,7 +34,7 @@ import kotlin.reflect.KClass * * @since v1-alpha10 */ -class LoggerConfiguration { +class LoggerConfiguration private constructor() { /** * Companion object of [LoggerConfiguration]. * @@ -137,11 +137,4 @@ class LoggerConfiguration { */ var featureDateTimeTZ: TimeZone = TimeZone.currentSystemDefault() } - - /** - * Initializes this class. - * - * @since v1-alpha10 - */ - private constructor() } diff --git a/logging/src/main/kotlin/de/staropensource/engine/logging/Processor.kt b/logging/src/main/kotlin/de/staropensource/engine/logging/Processor.kt index c3050e2e5..37a79bb56 100644 --- a/logging/src/main/kotlin/de/staropensource/engine/logging/Processor.kt +++ b/logging/src/main/kotlin/de/staropensource/engine/logging/Processor.kt @@ -38,14 +38,7 @@ import kotlin.reflect.full.primaryConstructor * * @since v1-alpha10 */ -class Processor { - /** - * Initializes this class. - * - * @since v1-alpha10 - */ - private constructor() - +class Processor private constructor() { /** * Companion object of [Processor]. * diff --git a/testapp/src/main/kotlin/de/staropensource/engine/testapp/Main.kt b/testapp/src/main/kotlin/de/staropensource/engine/testapp/Main.kt index f4140f660..bc499bb8f 100644 --- a/testapp/src/main/kotlin/de/staropensource/engine/testapp/Main.kt +++ b/testapp/src/main/kotlin/de/staropensource/engine/testapp/Main.kt @@ -28,7 +28,7 @@ import de.staropensource.engine.logging.Logger * * @since v1-alpha10 */ -class Main { +class Main private constructor() { /** * Companion object of [Main]. * @@ -53,11 +53,4 @@ class Main { logger.info("Hello World! Caused by and \\.") } } - - /** - * Initializes this class. - * - * @since v1-alpha10 - */ - private constructor() }