Migrate the io.spine.logging.jvm.parameter package to Kotlin - #103
Conversation
…ine.logging.jvm.parameter-package-to-kotlin # Conflicts: # dependencies.md # jvm/middleware/src/main/kotlin/io/spine/logging/jvm/parameter/DateTimeFormat.kt # pom.xml # version.gradle.kts
io.spine.logging.jvm.parameter package to Kotlin
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #103 +/- ##
============================================
- Coverage 59.48% 59.43% -0.05%
+ Complexity 703 696 -7
============================================
Files 121 121
Lines 3907 3905 -2
Branches 542 543 +1
============================================
- Hits 2324 2321 -3
- Misses 1375 1376 +1
Partials 208 208 🚀 New features to boost your workflow:
|
Also: * Transform `Parameter.getFormat()` to the property. * Rename `ParameterVisitor` to `ArgumentVisitor` per initial authors TODO comment.
Also: * Add missing documentation.
armiol
left a comment
There was a problem hiding this comment.
@alexander-yevsyukov please see my comment so far.
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the io.spine.logging.jvm.parameter package (and related visitor/parser logic) from Java to Kotlin, adds @Immutable and @ThreadSafe annotations across the codebase, and standardizes the ordering of arguments in the of() factory methods.
- Replace Java
Parameter,SimpleParameter,DateTimeParameter,BraceStyleParameter, andParameterVisitorwith Kotlin equivalents and update tests to useArgumentVisitor. - Add
@Immutableand@ThreadSafeannotations on many classes for thread-safety documentation. - Change
SimpleParameter.of()signature from(index, formatChar, options)to(formatChar, options, index)and update all call sites and tests accordingly.
Reviewed Changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| version.gradle.kts / pom.xml | Bump snapshot version |
| jvm/middleware/src/main/kotlin/io/spine/logging/jvm/parameter/SimpleParameter.kt | New Kotlin implementation with reordered factory method |
| jvm/middleware/src/main/kotlin/io/spine/logging/jvm/parameter/ArgumentVisitor.kt | Renamed and migrated ParameterVisitor interface to Kotlin |
| jvm/middleware/src/main/kotlin/io/spine/logging/jvm/parameter/DateTimeParameter.kt | New Kotlin date/time parameter implementation |
| jvm/middleware/src/main/kotlin/io/spine/logging/jvm/parameter/BraceStyleParameter.kt | New Kotlin brace-style parameter implementation |
| jvm/middleware/src/main/kotlin/io/spine/logging/jvm/parameter/Parameter.kt | New abstract Kotlin Parameter base class |
| jvm/middleware/src/test/kotlin/...ParserTestEnv.kt | Update to use ArgumentVisitor and format property |
| jvm/middleware/src/test/kotlin/...MessageParserSpec.kt | Update test imports and visitor usages |
| logging/src/jvmMain/kotlin/io/spine/logging/context/LoggingContextFactory.kt | Add thread-safety annotation |
| Multiple other backend/context/platform files | Add @Immutable and @ThreadSafe annotations |
| dependencies.md | Update snapshot version and timestamps in dependency reports |
| .agents/java-kotlin-conversion.md | Add instruction about inline comments |
Comments suppressed due to low confidence (2)
jvm/middleware/src/main/kotlin/io/spine/logging/jvm/parameter/SimpleParameter.kt:105
- Reordering the factory method parameters is a breaking change for Java callers; consider adding a deprecated overload
of(index: Int, formatChar: FormatChar, options: FormatOptions)that delegates to the new method for backward compatibility.
public fun of(formatChar: FormatChar, options: FormatOptions, index: Int): Parameter {
logging/src/jvmMain/kotlin/io/spine/logging/context/LoggingContextFactory.kt:49
- [nitpick] Kotlin
objectdeclarations are inherently thread-safe, so the@ThreadSafeannotation on theobjectmay be redundant.
@ThreadSafe
This PR migrates the
io.spine.logging.jvm.parameterpackage from Java to Kotlin.Other notable changes
@Immutableand@TreadSafeannotations.of()static factories.