Skip to content

Migrate the io.spine.logging.jvm.parameter package to Kotlin - #103

Merged
alexander-yevsyukov merged 14 commits into
masterfrom
codex/migrate-io.spine.logging.jvm.parameter-package-to-kotlin
Jul 13, 2025
Merged

Migrate the io.spine.logging.jvm.parameter package to Kotlin#103
alexander-yevsyukov merged 14 commits into
masterfrom
codex/migrate-io.spine.logging.jvm.parameter-package-to-kotlin

Conversation

@alexander-yevsyukov

@alexander-yevsyukov alexander-yevsyukov commented Jun 29, 2025

Copy link
Copy Markdown
Contributor

This PR migrates the io.spine.logging.jvm.parameter package from Java to Kotlin.

Other notable changes

  • Added @Immutable and @TreadSafe annotations.
  • Sorted out parameter orders in the of() static factories.

…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
@alexander-yevsyukov alexander-yevsyukov changed the title Migrate parameter package to Kotlin Migrate the io.spine.logging.jvm.parameter package to Kotlin Jul 13, 2025

This comment was marked as outdated.

@codecov

codecov Bot commented Jul 13, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 66.26506% with 28 lines in your changes missing coverage. Please review.

Project coverage is 59.43%. Comparing base (4537c17) to head (5af07b1).
Report is 15 commits behind head on master.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Also:
 * Transform `Parameter.getFormat()` to the property.
 * Rename `ParameterVisitor` to `ArgumentVisitor` per initial authors TODO comment.
Also:
 * Add missing documentation.

This comment was marked as outdated.

@armiol armiol left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexander-yevsyukov please see my comment so far.

Comment thread .agents/java-kotlin-conversion.md Outdated

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and ParameterVisitor with Kotlin equivalents and update tests to use ArgumentVisitor.
  • Add @Immutable and @ThreadSafe annotations 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 object declarations are inherently thread-safe, so the @ThreadSafe annotation on the object may be redundant.
@ThreadSafe

Comment thread dependencies.md
@alexander-yevsyukov
alexander-yevsyukov merged commit f52ede8 into master Jul 13, 2025
6 checks passed
@alexander-yevsyukov
alexander-yevsyukov deleted the codex/migrate-io.spine.logging.jvm.parameter-package-to-kotlin branch July 13, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants