From bc46045022bf12a7da0bacb97eef0c7a21eea002 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 24 Feb 2025 17:10:30 +0000 Subject: [PATCH 01/31] Bump version -> `2.0.0-SNAPSHOT.265` --- version.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.gradle.kts b/version.gradle.kts index 5b7dc1c0c..dbb72f541 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -31,5 +31,5 @@ * * For versions of Spine-based dependencies please see [io.spine.internal.dependency.spine]. */ -val mcJavaVersion by extra("2.0.0-SNAPSHOT.264") +val mcJavaVersion by extra("2.0.0-SNAPSHOT.265") val versionToPublish by extra(mcJavaVersion) From f9dded9142b7d49edd43c891c8de1c0e0b338a6d Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 24 Feb 2025 17:10:42 +0000 Subject: [PATCH 02/31] Bump local dependencies --- buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt | 4 ++-- .../src/main/kotlin/io/spine/dependency/local/ProtoData.kt | 2 +- .../src/main/kotlin/io/spine/dependency/local/Validation.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt index 1b7b10d2f..75bfc63bb 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt @@ -42,12 +42,12 @@ object McJava { /** * The version used to in the build classpath. */ - const val dogfoodingVersion = "2.0.0-SNAPSHOT.263" + const val dogfoodingVersion = "2.0.0-SNAPSHOT.264" /** * The version to be used for integration tests. */ - const val version = "2.0.0-SNAPSHOT.264" + const val version = "2.0.0-SNAPSHOT.265" /** * The ID of the Gradle plugin. diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt index 1639e8b57..02e974836 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt @@ -82,7 +82,7 @@ object ProtoData { * transitional dependencies, this is the version used to build the project itself. */ val dogfoodingVersion: String - private const val fallbackDfVersion = "0.92.6" + private const val fallbackDfVersion = "0.92.7" /** * The artifact for the ProtoData Gradle plugin. diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt index 24c2767be..fca209eb2 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt @@ -36,7 +36,7 @@ object Validation { /** * The version of the Validation library artifacts. */ - const val version = "2.0.0-SNAPSHOT.193" + const val version = "2.0.0-SNAPSHOT.194" const val group = "io.spine.validation" private const val prefix = "spine-validation" From 98d0658211a302f416d0ec5669547d573d4850a5 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 24 Feb 2025 17:15:33 +0000 Subject: [PATCH 03/31] Update dependency reports --- dependencies.md | 76 ++++++++++++++++++++++++------------------------- pom.xml | 16 +++++------ 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/dependencies.md b/dependencies.md index 74527f7ea..3228453fc 100644 --- a/dependencies.md +++ b/dependencies.md @@ -1,6 +1,6 @@ -# Dependencies of `io.spine.tools:spine-mc-java:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : aopalliance. **Name** : aopalliance. **Version** : 1.0. @@ -1046,12 +1046,12 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:25 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:04 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-annotation:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-annotation:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3. @@ -1969,12 +1969,12 @@ This report was generated on **Mon Feb 24 14:20:25 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:26 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:04 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-base:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-base:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3. @@ -2892,12 +2892,12 @@ This report was generated on **Mon Feb 24 14:20:26 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:26 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:04 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-checks:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-checks:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : aopalliance. **Name** : aopalliance. **Version** : 1.0. @@ -3708,12 +3708,12 @@ This report was generated on **Mon Feb 24 14:20:26 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:26 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-comparable:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-comparable:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3. @@ -4631,12 +4631,12 @@ This report was generated on **Mon Feb 24 14:20:26 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:26 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-comparable-tests:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-comparable-tests:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -5420,12 +5420,12 @@ This report was generated on **Mon Feb 24 14:20:26 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:26 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-entity:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-entity:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3. @@ -6343,12 +6343,12 @@ This report was generated on **Mon Feb 24 14:20:26 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:27 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-entity-tests:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-entity-tests:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -7124,12 +7124,12 @@ This report was generated on **Mon Feb 24 14:20:27 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:27 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-marker:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-marker:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3. @@ -8047,12 +8047,12 @@ This report was generated on **Mon Feb 24 14:20:27 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:27 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-marker-tests:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-marker-tests:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -8828,12 +8828,12 @@ This report was generated on **Mon Feb 24 14:20:27 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:27 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-message-group:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-message-group:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3. @@ -9751,12 +9751,12 @@ This report was generated on **Mon Feb 24 14:20:27 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:28 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-message-group-tests:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-message-group-tests:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -10532,12 +10532,12 @@ This report was generated on **Mon Feb 24 14:20:28 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:28 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-plugin-bundle:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-plugin-bundle:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : aopalliance. **Name** : aopalliance. **Version** : 1.0. @@ -11534,12 +11534,12 @@ This report was generated on **Mon Feb 24 14:20:28 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:28 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-routing:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-routing:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3. @@ -12516,12 +12516,12 @@ This report was generated on **Mon Feb 24 14:20:28 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:28 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-routing-tests:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-routing-tests:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -13338,12 +13338,12 @@ This report was generated on **Mon Feb 24 14:20:28 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:29 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-signal:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-signal:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3. @@ -14261,12 +14261,12 @@ This report was generated on **Mon Feb 24 14:20:29 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:29 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-signal-tests:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-signal-tests:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -15042,12 +15042,12 @@ This report was generated on **Mon Feb 24 14:20:29 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:29 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:08 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-uuid:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-uuid:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3. @@ -15965,12 +15965,12 @@ This report was generated on **Mon Feb 24 14:20:29 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:29 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Mon Feb 24 17:15:08 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.tools:spine-mc-java-uuid-tests:2.0.0-SNAPSHOT.264` +# Dependencies of `io.spine.tools:spine-mc-java-uuid-tests:2.0.0-SNAPSHOT.265` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -16746,4 +16746,4 @@ This report was generated on **Mon Feb 24 14:20:29 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 14:20:29 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Mon Feb 24 17:15:08 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/pom.xml b/pom.xml index 76f23cfda..2b6f265aa 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject. --> io.spine.tools mc-java -2.0.0-SNAPSHOT.264 +2.0.0-SNAPSHOT.265 2015 @@ -116,13 +116,13 @@ all modules and does not describe the project structure per-subproject. io.spine.validation spine-validation-configuration - 2.0.0-SNAPSHOT.193 + 2.0.0-SNAPSHOT.194 compile io.spine.validation spine-validation-java-runtime - 2.0.0-SNAPSHOT.193 + 2.0.0-SNAPSHOT.194 compile @@ -335,12 +335,12 @@ all modules and does not describe the project structure per-subproject. io.spine.protodata protodata-fat-cli - 0.92.6 + 0.92.7 io.spine.protodata protodata-protoc - 0.92.6 + 0.92.7 io.spine.tools @@ -355,18 +355,18 @@ all modules and does not describe the project structure per-subproject. io.spine.tools spine-mc-java-checks - 2.0.0-SNAPSHOT.263 + 2.0.0-SNAPSHOT.264 provided io.spine.tools spine-mc-java-plugins - 2.0.0-SNAPSHOT.263 + 2.0.0-SNAPSHOT.264 io.spine.validation spine-validation-java-bundle - 2.0.0-SNAPSHOT.193 + 2.0.0-SNAPSHOT.194 net.sourceforge.pmd From 0b5f903212e48eec86d2c178311243c0dba795ec Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 24 Feb 2025 18:38:31 +0000 Subject: [PATCH 04/31] Add documentation --- .../mc/java/routing/proessor/RouteFun.kt | 33 ++++++++++++++ .../mc/java/routing/proessor/RouteVisitor.kt | 43 +++++++++++++++++-- 2 files changed, 73 insertions(+), 3 deletions(-) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt index 71e0a49bb..61d6cde1f 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt @@ -31,18 +31,45 @@ import com.google.devtools.ksp.symbol.KSType import com.squareup.kotlinpoet.ClassName import com.squareup.kotlinpoet.ksp.toClassName +/** + * Provides information about a route function detected in the [declaringClass] + * + * @property decl The declaration of the function + * @property declaringClass The class that declares the function. + * @param parameters The parameter(s) of the function. + * If the [Pair.second] property is non-null the function accepts a context parameter. + * @param returnType The type returned by the function. + */ internal sealed class RouteFun( val decl: KSFunctionDeclaration, val declaringClass: EntityClass, parameters: Pair, returnType: KSType ) { + /** + * The type of the first parameter of the route function. + */ val messageParameter: KSType = parameters.first + + /** + * The class name of the first parameter. + */ val messageClass: ClassName = messageParameter.toClassName() + + /** + * Tells if the function accepts a context parameter. + */ val acceptsContext: Boolean = parameters.second != null + + /** + * Tells if the function returns one identifier rather than a set of identifiers. + */ val isUnicast: Boolean = returnType.declaration.typeParameters.isEmpty() } +/** + * The declaration of a route function for commands. + */ internal class CommandRouteFun( fn: KSFunctionDeclaration, declaringClass: EntityClass, @@ -50,6 +77,9 @@ internal class CommandRouteFun( returnType: KSType ) : RouteFun(fn, declaringClass, parameters, returnType) +/** + * The declaration of a route function for events. + */ internal class EventRouteFun( fn: KSFunctionDeclaration, declaringClass: EntityClass, @@ -57,6 +87,9 @@ internal class EventRouteFun( returnType: KSType ) : RouteFun(fn, declaringClass, parameters, returnType) +/** + * The declaration of a route function for entity states. + */ internal class StateUpdateRouteFun( fn: KSFunctionDeclaration, declaringClass: EntityClass, diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt index da4e5a3af..688e5fc40 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt @@ -53,26 +53,60 @@ import io.spine.string.Indent import io.spine.tools.mc.java.GeneratedAnnotation import io.spine.tools.mc.java.routing.proessor.Environment.SetupType +/** + * The base class for code generators implementing routing setup + * for a kind of route functions specified by the generic parameter [F]. + * + * The visitor generates a class named after the class declaring routing function(s) + * using the pattern: [entityClass] + [classNameSuffix]. The class is generated + * in the same package with the [entityClass]. + * + * @param F The type of route functions handled by the visitor. + * @property setup The type of routing setup class generated by this visitor. + * @property functions The route functions declared in the [entityClass]. + * @property environment The environment for code generation. + */ internal sealed class RouteVisitor( protected val setup: SetupType, private val functions: List, protected val environment: Environment, ) : KSVisitorVoid() { + /** + * The suffix added to the generated class. + */ protected abstract val classNameSuffix: String private lateinit var packageName: String private lateinit var originalFile: KSFile + /** + * The builder of the generated class. + */ protected lateinit var routingClass: TypeSpec.Builder + + /** + * The builder for the generated + * [setup][io.spine.server.route.setup.RoutingSetup.setup] function. + */ protected lateinit var setupFun: FunSpec.Builder + + /** + * The builder for the `run` block in the [setup][setupFun] function. + */ protected lateinit var routingRunBlock: CodeBlock.Builder + /** + * The class declaring route functions. + */ val entityClass: EntityClass by lazy { val fn = functions.first() fn.declaringClass } + /** + * The type of the entity identifiers. + */ private val idClassTypeArgument: KSTypeArgument by lazy { entityClass.idClassTypeArgument } @@ -114,7 +148,7 @@ internal sealed class RouteVisitor( .build() /** - * Adds the method that overrides [io.spine.server.route.RoutingSetup.entityClass]. + * Adds the method that overrides [io.spine.server.route.setup.RoutingSetup.entityClass]. */ private fun addEntityClassFunction() { val entityType = Entity::class.asClassName().parameterizedBy( @@ -153,6 +187,9 @@ internal sealed class RouteVisitor( .beginControlFlow("%N.run", paramName) } + /** + * The callback to add a route function to the routing schema. + */ protected abstract fun addRoute(fn: F) private fun closeSetupFunction() { @@ -161,7 +198,7 @@ internal sealed class RouteVisitor( routingClass.addFunction(setupFun.build()) } - fun writeFile() { + private fun writeFile() { val cls = routingClass.build() val code = FileSpec.builder(packageName, cls.name!!) .indent(Indent.defaultJavaIndent.value) @@ -176,7 +213,7 @@ internal sealed class RouteVisitor( /** * The name of the inline extension functions for classes extending * [MessageRouting][io.spine.server.route.MessageRouting] which are used in - * the generated code of [RoutingSetup][io.spine.server.route.RoutingSetup] classes. + * the generated code of [RoutingSetup][io.spine.server.route.setup.RoutingSetup] classes. */ internal const val ROUTE_FUN_NAME: String = "route" From 0be93a3c69be2aa8692388913bc84be67d64a36b Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 24 Feb 2025 20:52:58 +0000 Subject: [PATCH 05/31] Detect duplicated route functions --- .../main/kotlin/KSFunctionDeclarationExts.kt | 10 +++- .../routing/proessor/CommandRouteVisitor.kt | 2 +- .../mc/java/routing/proessor/CommonChecks.kt | 49 +++++++++++++++- .../mc/java/routing/proessor/EntityClass.kt | 32 +++++++++++ .../routing/proessor/EventRouteVisitor.kt | 2 +- .../mc/java/routing/proessor/RouteFun.kt | 57 +++++++++++++++++++ .../java/routing/proessor/RouteSignature.kt | 1 - .../mc/java/routing/proessor/RouteVisitor.kt | 7 ++- .../proessor/StateUpdateRouteVisitor.kt | 5 +- .../mc/java/routing/KotlinRouteErrorSpec.kt | 42 ++++++++++++++ 10 files changed, 198 insertions(+), 9 deletions(-) diff --git a/mc-java-routing/src/main/kotlin/KSFunctionDeclarationExts.kt b/mc-java-routing/src/main/kotlin/KSFunctionDeclarationExts.kt index 61ace9641..c2be3ac2e 100644 --- a/mc-java-routing/src/main/kotlin/KSFunctionDeclarationExts.kt +++ b/mc-java-routing/src/main/kotlin/KSFunctionDeclarationExts.kt @@ -28,6 +28,14 @@ import com.google.devtools.ksp.symbol.KSFunctionDeclaration import com.google.devtools.ksp.symbol.Origin.JAVA import com.google.devtools.ksp.symbol.Origin.JAVA_LIB +/** + * Obtains the short name of the function. + * + * @returns just a name without braces. + */ +internal val KSFunctionDeclaration.shortName: String + get() = simpleName.getShortName() + /** * Selects either diagnostic message depending on * the [origin][KSFunctionDeclaration.origin] of the declaration. @@ -47,6 +55,6 @@ internal fun KSFunctionDeclaration.msg(kotlin: String, java: String): String = */ internal val KSFunctionDeclaration.funRef: String get() { - val shortRef = "`${simpleName.getShortName()}()`" + val shortRef = "`$shortName()`" return msg("function $shortRef", "method $shortRef") } diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteVisitor.kt index 03c5f2020..be9b39655 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteVisitor.kt @@ -53,7 +53,7 @@ internal class CommandRouteVisitor( companion object { fun process(qualified: List, environment: Environment) { - runVisitors(qualified) { functions -> + runVisitors(qualified, environment) { functions -> CommandRouteVisitor(functions, environment) } } diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt index 4630def92..605342124 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt @@ -27,15 +27,14 @@ package io.spine.tools.mc.java.routing.proessor import com.google.devtools.ksp.processing.KSPLogger +import com.google.devtools.ksp.symbol.FileLocation import com.google.devtools.ksp.symbol.FunctionKind import com.google.devtools.ksp.symbol.KSClassDeclaration import com.google.devtools.ksp.symbol.KSFunctionDeclaration -import com.google.devtools.ksp.symbol.Origin import com.google.devtools.ksp.symbol.Origin.JAVA import com.google.devtools.ksp.symbol.Origin.KOTLIN import funRef import io.spine.server.entity.Entity -import io.spine.tools.mc.java.routing.proessor.RouteSignature.Companion.jvmStaticRef import io.spine.tools.mc.java.routing.proessor.RouteSignature.Companion.routeRef import msg @@ -121,3 +120,49 @@ internal fun KSFunctionDeclaration.declaringClass(environment: Environment): Ent } return EntityClass(declaringClass, environment.entityInterface) } + +/** + * Checks if given [functions] do not have the same type as the first parameter. + * + * If duplicates are found they are [reported][KSPLogger.error], and the function returns `true`. + * + * @return `true` if duplicating route functions found, `false` otherwise. + */ +internal fun findDuplicatedRoutes( + declaringClass: EntityClass, + functions: List, + environment: Environment +): Boolean { + val grouped = functions.groupBy { fn -> fn.messageClass } + val logger = environment.logger + var found = false + grouped.forEach { + var routes = it.value + if (routes.size > 1) { + // Sort duplicates by line numbers. + routes = routes.sortedBy { fn -> (fn.decl.location as? FileLocation)?.lineNumber } + + val nl = System.lineSeparator() + + // The qualified message class to be mentioned once in the error message. + // The functions will have the simple name. + val messageType = routes[0].messageClass.canonicalName + + // List the duplicates. + val duplicates = routes.map { fn -> + " * `${fn.asString(qualifiedParameters = false)}`" + }.joinToString(nl) + + logger.error( + "The class `$declaringClass` declares more than one route function" + + " for the same message class `$messageType`:$nl" + + duplicates + nl + + "Please have only one function per routed message class.", + // Give the last duplicate as the error pointer to be reported. + // This would allow the user to scroll back for the duplicate(s). + routes.last().decl) + } + found = true + } + return found +} diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt index 7c41e6ea9..e8120ef94 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt @@ -32,16 +32,32 @@ import com.google.devtools.ksp.symbol.KSType import com.google.devtools.ksp.symbol.KSTypeArgument import com.google.devtools.ksp.symbol.KSTypeReference +/** + * Provides information about an entity class. + * + * @property decl The declaration of the class. + * @param entityInterface The type of the [io.spine.server.entity.Entity] + * interface for resolving generic parameters. + */ internal class EntityClass( val decl: KSClassDeclaration, entityInterface: KSType ) { + /** + * Makes the given visitor visit the class declaration. + */ fun accept(visitor: RouteVisitor<*>, data: Unit) { decl.accept(visitor, data) } + /** + * The type of the entity class resolved without generic parameters. + */ val type: KSType by lazy { decl.asStarProjectedType() } + /** + * The type of the entity identifiers as [KSTypeArgument]. + */ val idClassTypeArgument: KSTypeArgument by lazy { val asEntity = decl.superTypes.find { entityInterface.isAssignableFrom(it.resolve()) @@ -53,14 +69,23 @@ internal class EntityClass( asEntity.element!!.typeArguments.first() } + /** + * The reference to the ID class. + */ private val idClassReference: KSTypeReference by lazy { idClassTypeArgument.type!! } + /** + * The type of the entity identifiers. + */ val idClass: KSType by lazy { idClassReference.resolve() } + /** + * The class which this entity class extends. + */ fun superClass(): KSType { val found = decl.superTypes.find { val superType = it.resolve().declaration @@ -78,4 +103,11 @@ internal class EntityClass( override fun hashCode(): Int { return decl.hashCode() } + + /** + * Obtains the qualified name of the entity class. + */ + override fun toString(): String { + return decl.qualifiedName!!.asString() + } } diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt index 1e06b13dc..c6a320b39 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt @@ -72,7 +72,7 @@ internal class EventRouteVisitor( * Processes the given route functions using [EventRouteVisitor]. */ internal fun process(qualified: List, environment: Environment) { - runVisitors(qualified) { functions -> + runVisitors(qualified, environment) { functions -> EventRouteVisitor(functions, environment) } } diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt index 61d6cde1f..d5a4e3619 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt @@ -30,6 +30,7 @@ import com.google.devtools.ksp.symbol.KSFunctionDeclaration import com.google.devtools.ksp.symbol.KSType import com.squareup.kotlinpoet.ClassName import com.squareup.kotlinpoet.ksp.toClassName +import shortName /** * Provides information about a route function detected in the [declaringClass] @@ -61,10 +62,66 @@ internal sealed class RouteFun( */ val acceptsContext: Boolean = parameters.second != null + /** + * The class of the message context, if the function accepts the second parameter. + */ + private val contextClass: ClassName? by lazy { + parameters.second?.toClassName() + } + /** * Tells if the function returns one identifier rather than a set of identifiers. */ val isUnicast: Boolean = returnType.declaration.typeParameters.isEmpty() + + /** + * Obtains the name of the function with the types of its parameters. + * + * @param qualifiedParameters If `true` the parameter types will be fully qualified. + * Otherwise, simple names will be used for the parameter types. + */ + fun asString(qualifiedParameters: Boolean): String { + return buildString { + append(decl.shortName) + append("(") + append( + if (qualifiedParameters) messageClass.canonicalName + else messageClass.simpleName + ) + if (acceptsContext) { + append(", ") + // There is no need for the qualified name for the context parameter. + append( + if (qualifiedParameters) contextClass!!.canonicalName + else contextClass!!.simpleName + ) + } + append(")") + } + } + + /** + * Gives the name of the function with fully qualified names for parameters. + */ + override fun toString(): String = asString(qualifiedParameters = true) + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as RouteFun + + if (decl != other.decl) return false + if (declaringClass != other.declaringClass) return false + + return true + } + + override fun hashCode(): Int { + var result = decl.hashCode() + result = 31 * result + declaringClass.hashCode() + return result + } } /** diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteSignature.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteSignature.kt index 6b36f969a..cb28abfad 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteSignature.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteSignature.kt @@ -151,7 +151,6 @@ internal sealed class RouteSignature( companion object { val routeRef by lazy { "`@${simply()}`" } - val jvmStaticRef by lazy { "`@${simply()}`" } fun qualify( functions: Sequence, diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt index 688e5fc40..d581c4897 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt @@ -229,14 +229,17 @@ internal sealed class RouteVisitor( internal inline fun , reified F : RouteFun> runVisitors( qualified: List, + environment: Environment, createVisitor: (List) -> V ) { val routing = qualified.filterIsInstance() val grouped = routing.groupByClasses() grouped.forEach { (declaringClass, functions) -> + if (!findDuplicatedRoutes(declaringClass, functions, environment)) { val v = createVisitor(functions) - declaringClass.accept(v, Unit) - v.writeFile() + declaringClass.accept(v, Unit) + v.writeFile() + } } } } diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt index 78100869a..ab55e1052 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt @@ -43,7 +43,10 @@ internal class StateUpdateRouteVisitor( companion object { fun process(qualified: List, environment: Environment) { - runVisitors(qualified) { functions -> + runVisitors( + qualified, + environment + ) { functions -> StateUpdateRouteVisitor(functions, environment) } } diff --git a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/KotlinRouteErrorSpec.kt b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/KotlinRouteErrorSpec.kt index 470b9b49d..c169f583d 100644 --- a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/KotlinRouteErrorSpec.kt +++ b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/KotlinRouteErrorSpec.kt @@ -35,6 +35,7 @@ import com.tschuchort.compiletesting.KotlinCompilation.ExitCode import com.tschuchort.compiletesting.KotlinCompilation.ExitCode.COMPILATION_ERROR import io.kotest.matchers.shouldBe import io.kotest.matchers.string.shouldContain +import io.kotest.matchers.string.shouldNotContain import io.spine.tools.mc.java.routing.proessor.RouteSignature.Companion.routeRef import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import org.junit.jupiter.api.DisplayName @@ -108,6 +109,47 @@ internal class KotlinRouteErrorSpec : RouteCompilationTest() { } } + private val duplicatedRoutes = kotlinFile("DuplicatedRoutes", """ + package io.spine.given.devices + + import io.spine.core.EventContext + import io.spine.given.devices.events.StatusReported + import io.spine.given.devices.events.DeviceRegistered + import io.spine.server.projection.Projection + import io.spine.server.route.Route + + class DuplicatedRoutes : Projection() { + + companion object { + @Route fun route(e: StatusReported): DeviceId = event.getDevice() + @Route fun route(e: DeviceRegistered): DeviceId = event.getDevice() + @Route fun routeAgain(e: StatusReported, ctx: EventContext): DeviceId = + event.getDevice() + } + } + """.trimIndent()) + + @Test + fun `when two or more route functions accept the same message type`() { + compilation.apply { + sources = listOf(duplicatedRoutes) + } + + val result = compilation.compileSilently() + + result.exitCode shouldBe COMPILATION_ERROR + result.messages.let { + it shouldContain "The class `io.spine.given.devices.DuplicatedRoutes` declares more" + + " than one route function for the same message class" + + " `io.spine.given.devices.events.StatusReported`:" + it shouldContain "`route(StatusReported)`" + it shouldContain "`routeAgain(StatusReported, EventContext)`" + it shouldContain "Please have only one function per routed message class." + // Not duplicated. + it shouldNotContain "DeviceRegistered" + } + } + /** * Correct routing method. */ From 3c23de0048855b74ca0bd229b2fbd10951822a15 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 24 Feb 2025 21:10:32 +0000 Subject: [PATCH 06/31] Improve code layout --- .../mc/java/routing/proessor/CommonChecks.kt | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt index 605342124..f1f7a5d01 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt @@ -133,36 +133,37 @@ internal fun findDuplicatedRoutes( functions: List, environment: Environment ): Boolean { - val grouped = functions.groupBy { fn -> fn.messageClass } val logger = environment.logger + val nl = System.lineSeparator() var found = false + // Group functions by the first parameter. + val grouped = functions.groupBy { fn -> fn.messageClass } grouped.forEach { var routes = it.value - if (routes.size > 1) { - // Sort duplicates by line numbers. - routes = routes.sortedBy { fn -> (fn.decl.location as? FileLocation)?.lineNumber } - - val nl = System.lineSeparator() - - // The qualified message class to be mentioned once in the error message. - // The functions will have the simple name. - val messageType = routes[0].messageClass.canonicalName + if (routes.size <= 1) { + return@forEach + } + found = true + // Sort duplicates by line numbers. + routes = routes.sortedBy { fn -> (fn.decl.location as? FileLocation)?.lineNumber } - // List the duplicates. - val duplicates = routes.map { fn -> - " * `${fn.asString(qualifiedParameters = false)}`" - }.joinToString(nl) + // The qualified message class to be mentioned once in the error message. + // The functions will have the simple name. + val messageType = routes[0].messageClass.canonicalName - logger.error( - "The class `$declaringClass` declares more than one route function" + - " for the same message class `$messageType`:$nl" + - duplicates + nl + - "Please have only one function per routed message class.", - // Give the last duplicate as the error pointer to be reported. - // This would allow the user to scroll back for the duplicate(s). - routes.last().decl) + // List the duplicates. + val duplicates = routes.joinToString(nl) { fn -> + " * `${fn.asString(qualifiedParameters = false)}`" } - found = true + logger.error( + "The class `$declaringClass` declares more than one route function" + + " for the same message class `$messageType`:$nl" + + duplicates + nl + + "Please have only one function per routed message class.", + // Give the last duplicate as the error pointer to be reported. + // This would allow the user to scroll back for the duplicate(s). + routes.last().decl + ) } return found } From d49060014441260e88ed2a991b63db5abb571d50 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 24 Feb 2025 21:15:40 +0000 Subject: [PATCH 07/31] Extract `lineNumber` property --- .../spine/tools/mc/java/routing/proessor/CommonChecks.kt | 2 +- .../io/spine/tools/mc/java/routing/proessor/RouteFun.kt | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt index f1f7a5d01..5c79e9fa1 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt @@ -145,7 +145,7 @@ internal fun findDuplicatedRoutes( } found = true // Sort duplicates by line numbers. - routes = routes.sortedBy { fn -> (fn.decl.location as? FileLocation)?.lineNumber } + routes = routes.sortedBy { fn -> fn.lineNumber } // The qualified message class to be mentioned once in the error message. // The functions will have the simple name. diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt index d5a4e3619..c2394cf81 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt @@ -26,6 +26,7 @@ package io.spine.tools.mc.java.routing.proessor +import com.google.devtools.ksp.symbol.FileLocation import com.google.devtools.ksp.symbol.KSFunctionDeclaration import com.google.devtools.ksp.symbol.KSType import com.squareup.kotlinpoet.ClassName @@ -47,6 +48,13 @@ internal sealed class RouteFun( parameters: Pair, returnType: KSType ) { + /** + * The line number of the function declaration. + */ + val lineNumber: Int by lazy { + (decl.location as? FileLocation)?.lineNumber ?: 0 + } + /** * The type of the first parameter of the route function. */ From 45929902ac9e97f8eeca8830f3d6d5d2ea538e08 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 24 Feb 2025 21:21:37 +0000 Subject: [PATCH 08/31] Simplify code flow --- .../spine/tools/mc/java/routing/proessor/RouteFun.kt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt index c2394cf81..63c42fb7e 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt @@ -89,20 +89,14 @@ internal sealed class RouteFun( * Otherwise, simple names will be used for the parameter types. */ fun asString(qualifiedParameters: Boolean): String { + fun ClassName.name(): String = if (qualifiedParameters) canonicalName else simpleName return buildString { append(decl.shortName) append("(") - append( - if (qualifiedParameters) messageClass.canonicalName - else messageClass.simpleName - ) + append(messageClass.name()) if (acceptsContext) { append(", ") - // There is no need for the qualified name for the context parameter. - append( - if (qualifiedParameters) contextClass!!.canonicalName - else contextClass!!.simpleName - ) + append(contextClass!!.name()) } append(")") } From 9cbbf0241c62f54c190b3eca6d9cc11c99339e80 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 25 Feb 2025 16:00:50 +0000 Subject: [PATCH 09/31] Turn the function into extension Also: * Improve docs. --- .../mc/java/routing/proessor/CommonChecks.kt | 19 +++++++++++++++---- .../mc/java/routing/proessor/EntityClass.kt | 10 ++++------ .../mc/java/routing/proessor/RouteVisitor.kt | 2 +- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt index 5c79e9fa1..38ee35398 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt @@ -27,7 +27,6 @@ package io.spine.tools.mc.java.routing.proessor import com.google.devtools.ksp.processing.KSPLogger -import com.google.devtools.ksp.symbol.FileLocation import com.google.devtools.ksp.symbol.FunctionKind import com.google.devtools.ksp.symbol.KSClassDeclaration import com.google.devtools.ksp.symbol.KSFunctionDeclaration @@ -102,6 +101,19 @@ private fun KSFunctionDeclaration.acceptsOneOrTwoParameters(logger: KSPLogger): return (!wrongNumber).toErrorCount() } +/** + * Obtains the entity class which declares this function. + * + * If the function is declared in a Kotlin companion object (which is the right way to declare + * routing functions in Kotlin), the function obtains the class enclosing the companion object. + * + * The function checks if the declaring class implements the [Entity] interface. + * If it does not, the error is logged using the logger of the [environment] pointing to + * this function declaration as the source of the error, and `null` is returned. + * + * @return The entity class which declares this routing function, or `null` if the class + * does not implement the [Entity] interface. + */ internal fun KSFunctionDeclaration.declaringClass(environment: Environment): EntityClass? { val parent = parentDeclaration!!.qualifiedName!! var declaringClass = environment.resolver.getClassDeclarationByName(parent)!! @@ -128,8 +140,7 @@ internal fun KSFunctionDeclaration.declaringClass(environment: Environment): Ent * * @return `true` if duplicating route functions found, `false` otherwise. */ -internal fun findDuplicatedRoutes( - declaringClass: EntityClass, +internal fun EntityClass.findDuplicatedRoutes( functions: List, environment: Environment ): Boolean { @@ -156,7 +167,7 @@ internal fun findDuplicatedRoutes( " * `${fn.asString(qualifiedParameters = false)}`" } logger.error( - "The class `$declaringClass` declares more than one route function" + + "The class `$this` declares more than one route function" + " for the same message class `$messageType`:$nl" + duplicates + nl + "Please have only one function per routed message class.", diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt index e8120ef94..2e7898254 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt @@ -38,6 +38,8 @@ import com.google.devtools.ksp.symbol.KSTypeReference * @property decl The declaration of the class. * @param entityInterface The type of the [io.spine.server.entity.Entity] * interface for resolving generic parameters. + * This is a supportive parameter that we pass instead of [Environment] instance + * to narrow down the dependencies of this class. */ internal class EntityClass( val decl: KSClassDeclaration, @@ -100,14 +102,10 @@ internal class EntityClass( return decl == other.decl } - override fun hashCode(): Int { - return decl.hashCode() - } + override fun hashCode(): Int = decl.hashCode() /** * Obtains the qualified name of the entity class. */ - override fun toString(): String { - return decl.qualifiedName!!.asString() - } + override fun toString(): String = decl.qualifiedName!!.asString() } diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt index d581c4897..2f2981658 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt @@ -235,7 +235,7 @@ internal sealed class RouteVisitor( val routing = qualified.filterIsInstance() val grouped = routing.groupByClasses() grouped.forEach { (declaringClass, functions) -> - if (!findDuplicatedRoutes(declaringClass, functions, environment)) { + if (!declaringClass.findDuplicatedRoutes(functions, environment)) { val v = createVisitor(functions) declaringClass.accept(v, Unit) v.writeFile() From 6cec7239bb9ced5eab89a12c5ddff17a6cf49a0d Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 25 Feb 2025 17:14:26 +0000 Subject: [PATCH 10/31] Improve documentation --- .../routing/proessor/CommandRouteVisitor.kt | 13 +++++ .../routing/proessor/EventRouteVisitor.kt | 19 +++++-- .../mc/java/routing/proessor/RouteVisitor.kt | 49 ++++++++++++++----- 3 files changed, 66 insertions(+), 15 deletions(-) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteVisitor.kt index be9b39655..b871c6991 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteVisitor.kt @@ -28,6 +28,15 @@ package io.spine.tools.mc.java.routing.proessor import com.squareup.kotlinpoet.ksp.toClassName +/** + * Creates a routing setup class for tuning + * [EventRouting][io.spine.server.route.CommandRouting] of a repository. + * + * The generated setup class will have the name after the pattern + * [<EntityClass>CommandRouting][classNameSuffix]. + * + * @see RouteVisitor + */ internal class CommandRouteVisitor( functions: List, environment: Environment @@ -52,6 +61,10 @@ internal class CommandRouteVisitor( } companion object { + + /** + * Processes the given route functions using [CommandRouteVisitor]. + */ fun process(qualified: List, environment: Environment) { runVisitors(qualified, environment) { functions -> CommandRouteVisitor(functions, environment) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt index c6a320b39..6c43a0f4f 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt @@ -28,6 +28,15 @@ package io.spine.tools.mc.java.routing.proessor import com.squareup.kotlinpoet.ksp.toClassName +/** + * Creates a routing setup class for tuning + * [EventRouting][io.spine.server.route.EventRouting] of a repository. + * + * The generated setup class will have the name after the pattern + * [<EntityClass>EventRouting][classNameSuffix]. + * + * @see RouteVisitor + */ internal class EventRouteVisitor( functions: List, environment: Environment @@ -39,13 +48,15 @@ internal class EventRouteVisitor( override val classNameSuffix: String = "EventRouting" /** - * Adds the entry in the routing setup function inside the [routingRunBlock]. + * Adds an entry for the given function [fn] in the routing + * [setup][io.spine.server.route.setup.EventRoutingSetup.setup] function + * inside the [routingRunBlock]. * - * For a multicast route it would be something like: + * For a [multicast][io.spine.server.route.Multicast] route it would be something like: * ```kotlin * route { e, c -> MyEntity.myRouteFun(e, c) } * ``` - * For an unicast route it would be something like: + * For an [unicast][io.spine.server.route.Unicast] route it would be something like: * ```kotlin * unicast { e, c -> MyEntity.myRoutFun(e, c) } * ``` @@ -53,7 +64,7 @@ internal class EventRouteVisitor( */ override fun addRoute(fn: EventRouteFun) { val params = if (fn.acceptsContext) "e, c" else "e" - val entryFn = if (fn.isUnicast) "unicast" else ROUTE_FUN_NAME + val entryFn = if (fn.isUnicast) UNICAST_FUN_NAME else ROUTE_FUN_NAME routingRunBlock.add( "%L<%T> { %L -> %T.%L(%L) }\n", diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt index 2f2981658..7dddc09f9 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt @@ -33,7 +33,6 @@ import com.google.devtools.ksp.symbol.KSFile import com.google.devtools.ksp.symbol.KSFunctionDeclaration import com.google.devtools.ksp.symbol.KSTypeArgument import com.google.devtools.ksp.symbol.KSVisitorVoid -import com.google.errorprone.annotations.OverridingMethodsMustInvokeSuper import com.squareup.kotlinpoet.AnnotationSpec import com.squareup.kotlinpoet.CodeBlock import com.squareup.kotlinpoet.FileSpec @@ -54,20 +53,27 @@ import io.spine.tools.mc.java.GeneratedAnnotation import io.spine.tools.mc.java.routing.proessor.Environment.SetupType /** - * The base class for code generators implementing routing setup - * for a kind of route functions specified by the generic parameter [F]. + * The base class for code generators implementing routing setup classes + * adding calls to the type of route functions specified by the generic parameter [F]. * * The visitor generates a class named after the class declaring routing function(s) * using the pattern: [entityClass] + [classNameSuffix]. The class is generated * in the same package with the [entityClass]. * + * The generated class will be annotated with the [AutoService] annotation which + * would accept the interface implemented by the generated class as the argument for + * the annotation. E.g., [EventRoutingSetup][io.spine.server.route.setup.EventRoutingSetup] or + * [CommandRoutingSetup][io.spine.server.route.setup.CommandRoutingSetup]. + * The reference to this interface is passed as the value of + * the [cls][SetupType.cls] property of the [setup] parameter. + * * @param F The type of route functions handled by the visitor. - * @property setup The type of routing setup class generated by this visitor. + * @property setup The type of the routing setup class generated by this visitor. * @property functions The route functions declared in the [entityClass]. * @property environment The environment for code generation. */ internal sealed class RouteVisitor( - protected val setup: SetupType, + private val setup: SetupType, private val functions: List, protected val environment: Environment, ) : KSVisitorVoid() { @@ -77,7 +83,14 @@ internal sealed class RouteVisitor( */ protected abstract val classNameSuffix: String + /** + * The name of the package for the generated class. + */ private lateinit var packageName: String + + /** + * The file declaring the class with the routing functions. + */ private lateinit var originalFile: KSFile /** @@ -93,13 +106,20 @@ internal sealed class RouteVisitor( /** * The builder for the `run` block in the [setup][setupFun] function. + * + * The generated block will look like this: + * ```kotlin + * routing.run { + * // Route functions are added here. This comment will not be added. + * } + * ``` */ protected lateinit var routingRunBlock: CodeBlock.Builder /** * The class declaring route functions. */ - val entityClass: EntityClass by lazy { + protected val entityClass: EntityClass by lazy { val fn = functions.first() fn.declaringClass } @@ -119,8 +139,7 @@ internal sealed class RouteVisitor( handleRouteFunctions() } - @OverridingMethodsMustInvokeSuper - protected open fun createClass(className: String) { + private fun createClass(className: String) { val generated = GeneratedAnnotation.forKotlinPoet() val autoService = AnnotationSpec.builder(AutoService::class) .addMember("%T::class", setup.cls) @@ -215,9 +234,17 @@ internal sealed class RouteVisitor( * [MessageRouting][io.spine.server.route.MessageRouting] which are used in * the generated code of [RoutingSetup][io.spine.server.route.setup.RoutingSetup] classes. */ - internal const val ROUTE_FUN_NAME: String = "route" + const val ROUTE_FUN_NAME: String = "route" + + /** + * The name of the inline extension function for classing extending + * [MessageRouting][io.spine.server.route.MessageRouting] which are used in + * the generated code of [RoutingSetup][io.spine.server.route.setup.RoutingSetup] classes + * for returning only [one entity identifier][io.spine.server.route.Unicast]. + */ + const val UNICAST_FUN_NAME: String = "unicast" - internal fun process( + fun process( allValid: Sequence, environment: Environment ) { @@ -227,7 +254,7 @@ internal sealed class RouteVisitor( StateUpdateRouteVisitor.process(qualified, environment) } - internal inline fun , reified F : RouteFun> runVisitors( + inline fun , reified F : RouteFun> runVisitors( qualified: List, environment: Environment, createVisitor: (List) -> V From 011069139b23e7f91f03f46eb35d3a557fc4932e Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 25 Feb 2025 18:24:27 +0000 Subject: [PATCH 11/31] Test generated command routing --- .../routing/tests/CommandRoutingSetupITest.kt | 80 +++++++++++++++++++ .../routing/tests/EventRoutingSetupITest.kt | 9 ++- .../spine/given/home/HomeAutomationContext.kt | 62 +++++++++----- .../proto/given/home/commands.proto | 5 +- 4 files changed, 133 insertions(+), 23 deletions(-) create mode 100644 mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/CommandRoutingSetupITest.kt diff --git a/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/CommandRoutingSetupITest.kt b/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/CommandRoutingSetupITest.kt new file mode 100644 index 000000000..697cb29cc --- /dev/null +++ b/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/CommandRoutingSetupITest.kt @@ -0,0 +1,80 @@ +/* + * Copyright 2025, TeamDev. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.tools.mc.java.routing.tests + +import io.spine.given.home.Device +import io.spine.given.home.DeviceAggregate +import io.spine.given.home.DeviceId +import io.kotest.matchers.shouldBe +import io.spine.given.home.State +import io.spine.given.home.commands.addDevice +import io.spine.given.home.commands.setState +import io.spine.given.home.homeAutomation +import io.spine.testing.server.blackbox.BlackBox +import io.spine.testing.server.blackbox.assertEntity +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +@DisplayName("Generated `CommandRoutingSetup` should") +internal class CommandRoutingSetupITest { + + @Test + fun `apply generated routes`() { + BlackBox.from(homeAutomation()).use { context -> + val l1 = DeviceId.generate() + + context.receivesCommand( + addDevice { + device = l1 + name = "First Lamp" + } + ) + + var lamp = context.readState(l1) + // The first command is handled using the standard routing + // via the first command field. + lamp.state shouldBe State.OFF + + context.receivesCommand( + setState { + device = l1 + state = State.ON + } + ) + + lamp = context.readState(l1) + // The command was handled via custom routing declared in the class. + lamp.state shouldBe State.ON + } + } +} + +/** + * Reads the state of the [DeviceAggregate] with the given ID. + */ +private fun BlackBox.readState(id: DeviceId) = + assertEntity(id).actual()?.state() as Device diff --git a/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/EventRoutingSetupITest.kt b/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/EventRoutingSetupITest.kt index a874a6d67..80d7c4cd2 100644 --- a/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/EventRoutingSetupITest.kt +++ b/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/EventRoutingSetupITest.kt @@ -38,11 +38,18 @@ import io.spine.given.home.homeAutomation import io.spine.testing.server.blackbox.BlackBox import org.junit.jupiter.api.Test import io.spine.testing.server.blackbox.assertEntity +import org.junit.jupiter.api.DisplayName +@DisplayName("Generated `EventRoutingSetup` should") internal class EventRoutingSetupITest { + /** + * This test verifies that routing functions declared in the [RoomProjection] class + * effectively work because the state of the projection is expected after + * the dispatched events. + */ @Test - fun `loads event routing setup as a service`() { + fun `apply generated routes`() { BlackBox.from(homeAutomation()).use { context -> val r1 = RoomId.generate() val lamp = DeviceId.generate() diff --git a/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt b/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt index 9f79dffdb..ed1c2b4cc 100644 --- a/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt +++ b/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt @@ -26,27 +26,34 @@ package io.spine.given.home +import com.google.common.annotations.VisibleForTesting import io.spine.core.Subscribe +import io.spine.given.home.commands.AddDevice +import io.spine.given.home.commands.SetState +import io.spine.given.home.events.DeviceAdded import io.spine.given.home.events.DeviceMoved import io.spine.given.home.events.RoomAdded import io.spine.given.home.events.RoomEvent import io.spine.given.home.events.RoomRenamed +import io.spine.given.home.events.StateChanged +import io.spine.given.home.events.deviceAdded +import io.spine.given.home.events.stateChanged import io.spine.protobuf.isDefault import io.spine.server.BoundedContext +import io.spine.server.aggregate.Aggregate +import io.spine.server.aggregate.Apply +import io.spine.server.command.Assign import io.spine.server.entity.alter import io.spine.server.projection.Projection -import io.spine.server.projection.ProjectionRepository -import io.spine.server.route.EventRouting -import io.spine.server.route.setup.EventRoutingSetup import io.spine.server.route.Route -import io.spine.server.route.setup.StateRoutingSetup -import io.spine.server.route.StateUpdateRouting fun homeAutomation(): BoundedContext = BoundedContext.singleTenant("HomeAutomation") - .add(RoomProjectionRepository()) + .add(RoomProjection::class.java) + .add(DeviceAggregate::class.java) .build() -public class RoomProjection : Projection() { +@VisibleForTesting +class RoomProjection : Projection() { @Subscribe internal fun on(e: RoomAdded) = alter { @@ -73,33 +80,46 @@ public class RoomProjection : Projection() { companion object { + /** + * The routing function accepting the interface. + */ @Route - @JvmStatic fun route(e: RoomEvent): RoomId = e.room + /** + * The routing function by event class. + */ @Route - @JvmStatic fun routeMoved(e: DeviceMoved): Set = if (e.prevRoom.isDefault()) setOf(e.room) else setOf(e.prevRoom, e.room) } } -internal class RoomProjectionRepository : ProjectionRepository() { +@VisibleForTesting +class DeviceAggregate : Aggregate() { - override fun setupEventRouting(routing: EventRouting) { - super.setupEventRouting(routing) + @Assign + internal fun handle(c: AddDevice): DeviceAdded = + deviceAdded { device = c.device; name = c.name } - // Remove routs added via reflective class analysis. - routing.run { - remove() - remove() - } + @Assign + internal fun handle(c: SetState): StateChanged = + stateChanged { device = id(); current = c.state } + + @Apply + private fun event(e: DeviceAdded) = alter { + name = e.name + state = State.OFF + } - EventRoutingSetup.apply(entityClass(), routing) + @Apply + private fun event(e: StateChanged) = alter { + state = e.current } - override fun setupStateRouting(routing: StateUpdateRouting) { - super.setupStateRouting(routing) - StateRoutingSetup.apply(entityClass(), routing) + companion object { + + @Route + fun command(c: SetState): DeviceId = c.device } } diff --git a/mc-java-routing-tests/src/testFixtures/proto/given/home/commands.proto b/mc-java-routing-tests/src/testFixtures/proto/given/home/commands.proto index 5c77e41c3..92fa36e8b 100644 --- a/mc-java-routing-tests/src/testFixtures/proto/given/home/commands.proto +++ b/mc-java-routing-tests/src/testFixtures/proto/given/home/commands.proto @@ -54,6 +54,9 @@ message MoveDevice { } message SetState { - DeviceId device = 1; + // Normally the first field of a command is the ID of the target entity. + // We deliberately put another field so that a route function would be "useful" + // for obtaining the device ID from the `device` field which comes second. State state = 2 [(required) = true]; + DeviceId device = 1; } From a3204dc15721dc75a97e00188ab3cbacfe22829c Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 25 Feb 2025 19:27:59 +0000 Subject: [PATCH 12/31] Add codegen for state update routing setup --- .../routing/tests/StateRoutingSetupITest.kt | 71 +++++++++++++++++++ .../spine/given/home/HomeAutomationContext.kt | 22 ++++++ .../proessor/StateUpdateRouteVisitor.kt | 19 ++++- 3 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/StateRoutingSetupITest.kt diff --git a/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/StateRoutingSetupITest.kt b/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/StateRoutingSetupITest.kt new file mode 100644 index 000000000..8cd41b745 --- /dev/null +++ b/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/StateRoutingSetupITest.kt @@ -0,0 +1,71 @@ +/* + * Copyright 2025, TeamDev. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.tools.mc.java.routing.tests + +import io.kotest.matchers.shouldBe +import io.spine.given.home.Home +import io.spine.given.home.HomeProjection +import io.spine.given.home.HomeProjection.Companion.SINGLETON_ID +import io.spine.given.home.RoomId +import io.spine.given.home.events.roomAdded +import io.spine.given.home.homeAutomation +import io.spine.testing.server.blackbox.BlackBox +import io.spine.testing.server.blackbox.assertEntity +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test + +@DisplayName("Generated `StateRoutingSetup` should") +internal class StateRoutingSetupITest { + + @Test + fun `apply generated routes`() { + BlackBox.from(homeAutomation()).use { context -> + val r1 = RoomId.generate() + val r2 = RoomId.generate() + + context.receivesEvent( + roomAdded { + room = r1 + name = "Living Room" + } + ) + context.receivesEvent( + roomAdded { + room = r2 + name = "Bedroom" + } + ) + + val home = context.assertEntity(SINGLETON_ID) + .actual()?.state() as Home + + // This means that two `Room` instances were routed by the routing + // function directing all the updates to the singleton. + home.roomList.map { it.name } shouldBe listOf("Living Room", "Bedroom") + } + } +} diff --git a/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt b/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt index ed1c2b4cc..21c3d3779 100644 --- a/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt +++ b/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt @@ -50,6 +50,7 @@ import io.spine.server.route.Route fun homeAutomation(): BoundedContext = BoundedContext.singleTenant("HomeAutomation") .add(RoomProjection::class.java) .add(DeviceAggregate::class.java) + .add(HomeProjection::class.java) .build() @VisibleForTesting @@ -123,3 +124,24 @@ class DeviceAggregate : Aggregate() { fun command(c: SetState): DeviceId = c.device } } + +@VisibleForTesting +class HomeProjection : Projection() { + + @Subscribe + internal fun on(updated: Room) = alter { + val builder = roomBuilderList.find { b -> b.id == updated.id } + if (builder != null) { + builder.clear().mergeFrom(updated) + } else { + addRoom(updated) + } + } + + companion object { + const val SINGLETON_ID = "OurHome" + + @Route + internal fun room(@Suppress("UNUSED_PARAMETER") r: Room): String = SINGLETON_ID + } +} diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt index ab55e1052..1d23c0bcb 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt @@ -26,6 +26,8 @@ package io.spine.tools.mc.java.routing.proessor +import com.squareup.kotlinpoet.ksp.toClassName + internal class StateUpdateRouteVisitor( functions: List, environment: Environment @@ -38,10 +40,25 @@ internal class StateUpdateRouteVisitor( override val classNameSuffix: String = "StateUpdateRouting" override fun addRoute(fn: StateUpdateRouteFun) { - //TODO:2025-01-22:alexander.yevsyukov: Implement. + val params = if (fn.acceptsContext) "e, c" else "e" + val entryFn = if (fn.isUnicast) UNICAST_FUN_NAME else ROUTE_FUN_NAME + + routingRunBlock.add( + "%L<%T> { %L -> %T.%L(%L) }\n", + entryFn, + fn.messageClass, + params, + entityClass.type.toClassName(), + fn.decl.simpleName.asString(), + params + ) } companion object { + + /** + * Processes the given route functions using [StateUpdateRouteVisitor]. + */ fun process(qualified: List, environment: Environment) { runVisitors( qualified, From 024616054f4aedc07ea62803464c57405af61f1e Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 25 Feb 2025 20:11:36 +0000 Subject: [PATCH 13/31] Introduce an abstract base for multicast setup generators --- .../routing/proessor/EventRouteVisitor.kt | 37 +------- .../routing/proessor/MulticastRouteVisitor.kt | 85 +++++++++++++++++++ .../mc/java/routing/proessor/RouteVisitor.kt | 2 +- .../proessor/StateUpdateRouteVisitor.kt | 30 +++---- 4 files changed, 100 insertions(+), 54 deletions(-) create mode 100644 mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/MulticastRouteVisitor.kt diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt index 6c43a0f4f..737b1af0a 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt @@ -26,8 +26,6 @@ package io.spine.tools.mc.java.routing.proessor -import com.squareup.kotlinpoet.ksp.toClassName - /** * Creates a routing setup class for tuning * [EventRouting][io.spine.server.route.EventRouting] of a repository. @@ -35,47 +33,18 @@ import com.squareup.kotlinpoet.ksp.toClassName * The generated setup class will have the name after the pattern * [<EntityClass>EventRouting][classNameSuffix]. * - * @see RouteVisitor + * @see MulticastRouteVisitor */ internal class EventRouteVisitor( functions: List, environment: Environment -) : RouteVisitor( +) : MulticastRouteVisitor( environment.eventRoutingSetup, functions, environment ) { override val classNameSuffix: String = "EventRouting" - - /** - * Adds an entry for the given function [fn] in the routing - * [setup][io.spine.server.route.setup.EventRoutingSetup.setup] function - * inside the [routingRunBlock]. - * - * For a [multicast][io.spine.server.route.Multicast] route it would be something like: - * ```kotlin - * route { e, c -> MyEntity.myRouteFun(e, c) } - * ``` - * For an [unicast][io.spine.server.route.Unicast] route it would be something like: - * ```kotlin - * unicast { e, c -> MyEntity.myRoutFun(e, c) } - * ``` - * If a route function does not accept context, the lambdas would have only the `e` parameter. - */ - override fun addRoute(fn: EventRouteFun) { - val params = if (fn.acceptsContext) "e, c" else "e" - val entryFn = if (fn.isUnicast) UNICAST_FUN_NAME else ROUTE_FUN_NAME - - routingRunBlock.add( - "%L<%T> { %L -> %T.%L(%L) }\n", - entryFn, - fn.messageClass, - params, - entityClass.type.toClassName(), - fn.decl.simpleName.asString(), - params - ) - } + override val messageParameterName: String = "e" companion object { diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/MulticastRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/MulticastRouteVisitor.kt new file mode 100644 index 000000000..77d001a4d --- /dev/null +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/MulticastRouteVisitor.kt @@ -0,0 +1,85 @@ +/* + * Copyright 2025, TeamDev. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.tools.mc.java.routing.proessor + +import com.squareup.kotlinpoet.ksp.toClassName +import io.spine.tools.mc.java.routing.proessor.Environment.SetupType + +/** + * The base class for generators of the routing setup classes that + * serve [multicast][io.spine.server.route.Multicast] routing schemas. + * + * @param F The type of route functions handled by the visitor. + * @param setup The type of the routing setup class generated by this visitor. + * @param functions The route functions declared in the [entityClass]. + * @param environment The environment for code generation. + */ +internal sealed class MulticastRouteVisitor( + setup: SetupType, + functions: List, + environment: Environment +) : RouteVisitor(setup, functions, environment) { + + /** + * The name of the message parameter passed to the routing function in the generated code. + * + * Can be any string valid as a name for a Kotlin variable, but `"c"`, + * which is reserved for the second parameter. + */ + protected abstract val messageParameterName: String + + /** + * Adds an entry for the given function [fn] in the routing + * [setup][io.spine.server.route.setup.RoutingSetup.setup] function + * inside the [routingRunBlock]. + * + * For a [multicast][io.spine.server.route.Multicast] route it would be something like: + * ```kotlin + * route { e, c -> MyEntity.myRouteFun(e, c) } + * ``` + * For an [unicast][io.spine.server.route.Unicast] route it would be something like: + * ```kotlin + * unicast { e, c -> MyEntity.myRoutFun(e, c) } + * ``` + * If a route function does not accept context, the lambdas would have only the `e` parameter. + */ + override fun addRoute(fn: F) { + val p = messageParameterName + val params = if (fn.acceptsContext) "$p, c" else p + val entryFn = if (fn.isUnicast) UNICAST_FUN_NAME else ROUTE_FUN_NAME + + routingRunBlock.add( + "%L<%T> { %L -> %T.%L(%L) }\n", + entryFn, + fn.messageClass, + params, + entityClass.type.toClassName(), + fn.decl.simpleName.asString(), + params + ) + } +} diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt index 7dddc09f9..f5f7fbf78 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt @@ -75,7 +75,7 @@ import io.spine.tools.mc.java.routing.proessor.Environment.SetupType internal sealed class RouteVisitor( private val setup: SetupType, private val functions: List, - protected val environment: Environment, + protected val environment: Environment ) : KSVisitorVoid() { /** diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt index 1d23c0bcb..4dc59ca08 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt @@ -26,33 +26,25 @@ package io.spine.tools.mc.java.routing.proessor -import com.squareup.kotlinpoet.ksp.toClassName - +/** + * Creates a routing setup class for tuning + * [StateUpdateRouting][io.spine.server.route.StateUpdateRouting] of a repository. + * + * The generated setup class will have the name after the pattern + * [<EntityClass>StateUpdateRouting][classNameSuffix]. + * + * @see MulticastRouteVisitor + */ internal class StateUpdateRouteVisitor( functions: List, environment: Environment -) : RouteVisitor( +) : MulticastRouteVisitor( environment.stateRoutingSetup, functions, environment ) { - override val classNameSuffix: String = "StateUpdateRouting" - - override fun addRoute(fn: StateUpdateRouteFun) { - val params = if (fn.acceptsContext) "e, c" else "e" - val entryFn = if (fn.isUnicast) UNICAST_FUN_NAME else ROUTE_FUN_NAME - - routingRunBlock.add( - "%L<%T> { %L -> %T.%L(%L) }\n", - entryFn, - fn.messageClass, - params, - entityClass.type.toClassName(), - fn.decl.simpleName.asString(), - params - ) - } + override val messageParameterName: String = "s" companion object { From 6e314ad59d4b03be0691126de821a4f0ef7fbd95 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 25 Feb 2025 20:23:37 +0000 Subject: [PATCH 14/31] Fix the dependency on `AutoService.annotations` --- mc-java-routing/build.gradle.kts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mc-java-routing/build.gradle.kts b/mc-java-routing/build.gradle.kts index b432ac88f..967abbd74 100644 --- a/mc-java-routing/build.gradle.kts +++ b/mc-java-routing/build.gradle.kts @@ -42,14 +42,18 @@ plugins { dependencies { ksp(AutoServiceKsp.processor) - compileOnlyApi(AutoService.annotations) + implementation(AutoService.annotations)?.because( + """ + We use the `@AutoService` annotation not only to annotate `RouteProcessorProvider` as + a service provider but also for annotating the generated code. + """.trimIndent() + ) implementation(kotlin("stdlib")) implementation(Ksp.symbolProcessingApi) implementation(KotlinPoet.ksp) implementation(CoreJava.server) implementation(project(":mc-java-base")) - testImplementation(AutoService.annotations) testImplementation(Kotest.assertions) testImplementation(KotlinCompileTesting.libKsp) testImplementation(Logging.testLib) From cf7ee033190cd9c3ea1e5e21659efcf38fdf860d Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 25 Feb 2025 20:46:55 +0000 Subject: [PATCH 15/31] Update build time --- dependencies.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.md b/dependencies.md index 3228453fc..ce499188d 100644 --- a/dependencies.md +++ b/dependencies.md @@ -13338,7 +13338,7 @@ This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Feb 25 20:22:57 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). From bac82edc2cb0cd19dd6545a6db3bc0b16cd02881 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 25 Feb 2025 21:32:34 +0000 Subject: [PATCH 16/31] Improve documentation --- .../mc/java/routing/proessor/Qualifier.kt | 12 ++++++- .../mc/java/routing/proessor/RouteVisitor.kt | 31 +++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Qualifier.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Qualifier.kt index e283bedb4..1df88ecfa 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Qualifier.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Qualifier.kt @@ -31,7 +31,7 @@ import io.spine.tools.mc.java.routing.proessor.RouteSignature.Companion.routeRef /** * The helper class which transforms the incoming sequence with [functions] into - * a list containing [CommandRouteFun] or [EventRouteFun]. + * a list containing [CommandRouteFun], [EventRouteFun], or [StateUpdateRouteFun]. * * If a function is not recognized to be one of these types, * the compilation terminates with an error. @@ -45,6 +45,16 @@ internal class Qualifier( private val eventRoutes = EventRouteSignature(environment) private val stateRoutes = StateUpdateRouteSignature(environment) + /** + * Transforms the incoming sequence of [KSFunctionDeclaration] instances + * into the list of [RouteFun] by analyzing their signatures. + * + * Each function goes through [common checks][KSFunctionDeclaration.commonChecks]. + * Failed checks are reported as errors via [Environment.logger]. + * + * If at least one error is detected, the function terminates with [IllegalStateException] + * after all the functions are checked. + */ fun run(): List { val result = mutableListOf() functions.forEach { fn -> diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt index f5f7fbf78..3348543b0 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt @@ -244,6 +244,13 @@ internal sealed class RouteVisitor( */ const val UNICAST_FUN_NAME: String = "unicast" + /** + * Runs all the visitors through the given sequence of found functions. + * + * @see CommandRouteVisitor + * @see EventRouteVisitor + * @see StateUpdateRouteVisitor + */ fun process( allValid: Sequence, environment: Environment @@ -254,12 +261,32 @@ internal sealed class RouteVisitor( StateUpdateRouteVisitor.process(qualified, environment) } + /** + * Runs a visitor through the list of given functions. + * + * The visitor runs only through a sub-list of functions containing only + * instances of the generic parameter [F] of this function. + * For example, a [CommandRouteVisitor] ([V]) will only run + * through [CommandRouteFun] ([F]) instances. + * + * The function also performs the check for + * [duplicated route functions][EntityClass.findDuplicatedRoutes] per declaring class. + * If such duplicates are found, errors will be logged and all the functions of + * the declaring class will not be processed by the visitor. + * + * @param V The type of the [RouteVisitor] used during the traversal. + * @param F The type of the [RouteFun] processed by the visitor. + * @param allFunctions All the routing functions found by the annotation processor and + * [transformed][Qualifier] into [RouteFun] instances. + * @param environment The environment of the code generation. + * @param createVisitor The function to create an instance of the visitor class. + */ inline fun , reified F : RouteFun> runVisitors( - qualified: List, + allFunctions: List, environment: Environment, createVisitor: (List) -> V ) { - val routing = qualified.filterIsInstance() + val routing = allFunctions.filterIsInstance() val grouped = routing.groupByClasses() grouped.forEach { (declaringClass, functions) -> if (!declaringClass.findDuplicatedRoutes(functions, environment)) { From b0a2dabf043a811472a22283840ce7e301bf40a6 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 14:59:29 +0000 Subject: [PATCH 17/31] Bump local dependencies --- buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt | 4 ++-- .../src/main/kotlin/io/spine/dependency/local/ProtoData.kt | 4 ++-- .../src/main/kotlin/io/spine/dependency/local/Validation.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt index 1e2daa69a..0772f8765 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt @@ -33,8 +33,8 @@ package io.spine.dependency.local */ @Suppress("ConstPropertyName") object Base { - const val version = "2.0.0-SNAPSHOT.242" - const val versionForBuildScript = "2.0.0-SNAPSHOT.242" + const val version = "2.0.0-SNAPSHOT.243" + const val versionForBuildScript = "2.0.0-SNAPSHOT.243" const val group = Spine.group const val artifact = "spine-base" const val lib = "$group:$artifact:$version" diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt index 02e974836..c5afba44c 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt @@ -73,7 +73,7 @@ object ProtoData { * The version of ProtoData dependencies. */ val version: String - private const val fallbackVersion = "0.92.7" + private const val fallbackVersion = "0.92.9" /** * The distinct version of ProtoData used by other build tools. @@ -82,7 +82,7 @@ object ProtoData { * transitional dependencies, this is the version used to build the project itself. */ val dogfoodingVersion: String - private const val fallbackDfVersion = "0.92.7" + private const val fallbackDfVersion = "0.92.9" /** * The artifact for the ProtoData Gradle plugin. diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt index fca209eb2..ddcacf7d4 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt @@ -36,7 +36,7 @@ object Validation { /** * The version of the Validation library artifacts. */ - const val version = "2.0.0-SNAPSHOT.194" + const val version = "2.0.0-SNAPSHOT.195" const val group = "io.spine.validation" private const val prefix = "spine-validation" From 0052047e62d3ca5ab4b7ac3960ed95313983adef Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 15:06:07 +0000 Subject: [PATCH 18/31] Update dependency report --- dependencies.md | 130 +++++++++++++++++++++++++++++++++++++++++------- pom.xml | 20 ++++---- 2 files changed, 121 insertions(+), 29 deletions(-) diff --git a/dependencies.md b/dependencies.md index ce499188d..e2f318206 100644 --- a/dependencies.md +++ b/dependencies.md @@ -757,6 +757,14 @@ 1. **Group** : org.apache.httpcomponents.core5. **Name** : httpcore5-h2. **Version** : 5.1.3. * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : org.apache.logging.log4j. **Name** : log4j-api. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group** : org.apache.logging.log4j. **Name** : log4j-core. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : org.apiguardian. **Name** : apiguardian-api. **Version** : 1.1.2. * **Project URL:** [https://github.com/apiguardian-team/apiguardian](https://github.com/apiguardian-team/apiguardian) * **License:** [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -1046,7 +1054,7 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:04 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:31 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -1969,7 +1977,7 @@ This report was generated on **Mon Feb 24 17:15:04 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:04 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -2627,6 +2635,14 @@ This report was generated on **Mon Feb 24 17:15:04 WET 2025** using [Gradle-Lice 1. **Group** : org.apache.httpcomponents.core5. **Name** : httpcore5-h2. **Version** : 5.1.3. * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : org.apache.logging.log4j. **Name** : log4j-api. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group** : org.apache.logging.log4j. **Name** : log4j-core. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : org.apiguardian. **Name** : apiguardian-api. **Version** : 1.1.2. * **Project URL:** [https://github.com/apiguardian-team/apiguardian](https://github.com/apiguardian-team/apiguardian) * **License:** [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -2892,7 +2908,7 @@ This report was generated on **Mon Feb 24 17:15:04 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:04 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -3708,7 +3724,7 @@ This report was generated on **Mon Feb 24 17:15:04 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -4631,7 +4647,7 @@ This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -5420,7 +5436,7 @@ This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:33 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -6343,7 +6359,7 @@ This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:33 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -6867,6 +6883,14 @@ This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-Lice 1. **Group** : org.apache.httpcomponents.core5. **Name** : httpcore5-h2. **Version** : 5.1.3. * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : org.apache.logging.log4j. **Name** : log4j-api. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group** : org.apache.logging.log4j. **Name** : log4j-core. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : org.apiguardian. **Name** : apiguardian-api. **Version** : 1.1.2. * **Project URL:** [https://github.com/apiguardian-team/apiguardian](https://github.com/apiguardian-team/apiguardian) * **License:** [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -7124,7 +7148,7 @@ This report was generated on **Mon Feb 24 17:15:05 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:33 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -7782,6 +7806,14 @@ This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-Lice 1. **Group** : org.apache.httpcomponents.core5. **Name** : httpcore5-h2. **Version** : 5.1.3. * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : org.apache.logging.log4j. **Name** : log4j-api. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group** : org.apache.logging.log4j. **Name** : log4j-core. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : org.apiguardian. **Name** : apiguardian-api. **Version** : 1.1.2. * **Project URL:** [https://github.com/apiguardian-team/apiguardian](https://github.com/apiguardian-team/apiguardian) * **License:** [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -8047,7 +8079,7 @@ This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -8571,6 +8603,14 @@ This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-Lice 1. **Group** : org.apache.httpcomponents.core5. **Name** : httpcore5-h2. **Version** : 5.1.3. * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : org.apache.logging.log4j. **Name** : log4j-api. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group** : org.apache.logging.log4j. **Name** : log4j-core. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : org.apiguardian. **Name** : apiguardian-api. **Version** : 1.1.2. * **Project URL:** [https://github.com/apiguardian-team/apiguardian](https://github.com/apiguardian-team/apiguardian) * **License:** [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -8828,7 +8868,7 @@ This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -9486,6 +9526,14 @@ This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-Lice 1. **Group** : org.apache.httpcomponents.core5. **Name** : httpcore5-h2. **Version** : 5.1.3. * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : org.apache.logging.log4j. **Name** : log4j-api. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group** : org.apache.logging.log4j. **Name** : log4j-core. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : org.apiguardian. **Name** : apiguardian-api. **Version** : 1.1.2. * **Project URL:** [https://github.com/apiguardian-team/apiguardian](https://github.com/apiguardian-team/apiguardian) * **License:** [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -9751,7 +9799,7 @@ This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -10275,6 +10323,14 @@ This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-Lice 1. **Group** : org.apache.httpcomponents.core5. **Name** : httpcore5-h2. **Version** : 5.1.3. * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : org.apache.logging.log4j. **Name** : log4j-api. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group** : org.apache.logging.log4j. **Name** : log4j-core. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : org.apiguardian. **Name** : apiguardian-api. **Version** : 1.1.2. * **Project URL:** [https://github.com/apiguardian-team/apiguardian](https://github.com/apiguardian-team/apiguardian) * **License:** [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -10532,7 +10588,7 @@ This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -11534,7 +11590,7 @@ This report was generated on **Mon Feb 24 17:15:06 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -11583,6 +11639,10 @@ This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-Lice * **Project URL:** [https://github.com/googleapis/sdk-platform-java](https://github.com/googleapis/sdk-platform-java) * **License:** [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : com.google.auto.service. **Name** : auto-service-annotations. **Version** : 1.1.1. + * **Project URL:** [https://github.com/google/auto/tree/main/service](https://github.com/google/auto/tree/main/service) + * **License:** [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. * **Project URL:** [http://findbugs.sourceforge.net/](http://findbugs.sourceforge.net/) * **License:** [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -12516,7 +12576,7 @@ This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -13338,7 +13398,7 @@ This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Feb 25 20:22:57 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -13996,6 +14056,14 @@ This report was generated on **Tue Feb 25 20:22:57 WET 2025** using [Gradle-Lice 1. **Group** : org.apache.httpcomponents.core5. **Name** : httpcore5-h2. **Version** : 5.1.3. * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : org.apache.logging.log4j. **Name** : log4j-api. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group** : org.apache.logging.log4j. **Name** : log4j-core. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : org.apiguardian. **Name** : apiguardian-api. **Version** : 1.1.2. * **Project URL:** [https://github.com/apiguardian-team/apiguardian](https://github.com/apiguardian-team/apiguardian) * **License:** [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -14261,7 +14329,7 @@ This report was generated on **Tue Feb 25 20:22:57 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -14785,6 +14853,14 @@ This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-Lice 1. **Group** : org.apache.httpcomponents.core5. **Name** : httpcore5-h2. **Version** : 5.1.3. * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : org.apache.logging.log4j. **Name** : log4j-api. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group** : org.apache.logging.log4j. **Name** : log4j-core. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : org.apiguardian. **Name** : apiguardian-api. **Version** : 1.1.2. * **Project URL:** [https://github.com/apiguardian-team/apiguardian](https://github.com/apiguardian-team/apiguardian) * **License:** [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -15042,7 +15118,7 @@ This report was generated on **Mon Feb 24 17:15:07 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:08 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -15700,6 +15776,14 @@ This report was generated on **Mon Feb 24 17:15:08 WET 2025** using [Gradle-Lice 1. **Group** : org.apache.httpcomponents.core5. **Name** : httpcore5-h2. **Version** : 5.1.3. * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : org.apache.logging.log4j. **Name** : log4j-api. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group** : org.apache.logging.log4j. **Name** : log4j-core. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : org.apiguardian. **Name** : apiguardian-api. **Version** : 1.1.2. * **Project URL:** [https://github.com/apiguardian-team/apiguardian](https://github.com/apiguardian-team/apiguardian) * **License:** [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -15965,7 +16049,7 @@ This report was generated on **Mon Feb 24 17:15:08 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:08 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 15:05:36 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -16489,6 +16573,14 @@ This report was generated on **Mon Feb 24 17:15:08 WET 2025** using [Gradle-Lice 1. **Group** : org.apache.httpcomponents.core5. **Name** : httpcore5-h2. **Version** : 5.1.3. * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) +1. **Group** : org.apache.logging.log4j. **Name** : log4j-api. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + +1. **Group** : org.apache.logging.log4j. **Name** : log4j-core. **Version** : 2.20.0. + * **Project URL:** [https://www.apache.org/](https://www.apache.org/) + * **License:** [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) + 1. **Group** : org.apiguardian. **Name** : apiguardian-api. **Version** : 1.1.2. * **Project URL:** [https://github.com/apiguardian-team/apiguardian](https://github.com/apiguardian-team/apiguardian) * **License:** [The Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -16746,4 +16838,4 @@ This report was generated on **Mon Feb 24 17:15:08 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Mon Feb 24 17:15:08 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Wed Feb 26 15:05:36 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2b6f265aa..2aecd5501 100644 --- a/pom.xml +++ b/pom.xml @@ -56,13 +56,13 @@ all modules and does not describe the project structure per-subproject. io.spine protodata - 0.92.7 + 0.92.9 compile io.spine spine-base - 2.0.0-SNAPSHOT.242 + 2.0.0-SNAPSHOT.243 compile @@ -86,13 +86,13 @@ all modules and does not describe the project structure per-subproject. io.spine.protodata protodata-java - 0.92.7 + 0.92.9 compile io.spine.protodata protodata-params - 0.92.7 + 0.92.9 compile @@ -116,13 +116,13 @@ all modules and does not describe the project structure per-subproject. io.spine.validation spine-validation-configuration - 2.0.0-SNAPSHOT.194 + 2.0.0-SNAPSHOT.195 compile io.spine.validation spine-validation-java-runtime - 2.0.0-SNAPSHOT.194 + 2.0.0-SNAPSHOT.195 compile @@ -188,7 +188,7 @@ all modules and does not describe the project structure per-subproject. io.spine.protodata protodata-testlib - 0.92.7 + 0.92.9 test @@ -335,12 +335,12 @@ all modules and does not describe the project structure per-subproject. io.spine.protodata protodata-fat-cli - 0.92.7 + 0.92.9 io.spine.protodata protodata-protoc - 0.92.7 + 0.92.9 io.spine.tools @@ -366,7 +366,7 @@ all modules and does not describe the project structure per-subproject. io.spine.validation spine-validation-java-bundle - 2.0.0-SNAPSHOT.194 + 2.0.0-SNAPSHOT.195 net.sourceforge.pmd From adeeaf6a44e34e9dc5f06d97fb3c924ff8acb1ac Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 16:46:35 +0000 Subject: [PATCH 19/31] Bump Base -> `2.0.0-SNAPSHOT.244` --- buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt index 0772f8765..beaa9aa2a 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt @@ -33,8 +33,8 @@ package io.spine.dependency.local */ @Suppress("ConstPropertyName") object Base { - const val version = "2.0.0-SNAPSHOT.243" - const val versionForBuildScript = "2.0.0-SNAPSHOT.243" + const val version = "2.0.0-SNAPSHOT.244" + const val versionForBuildScript = "2.0.0-SNAPSHOT.244" const val group = Spine.group const val artifact = "spine-base" const val lib = "$group:$artifact:$version" From cbd1cc158767f49f6266b7586b05b68f2c3a44cc Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 16:47:55 +0000 Subject: [PATCH 20/31] Improve code layout --- .../tools/mc/java/routing/tests/CommandRoutingSetupITest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/CommandRoutingSetupITest.kt b/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/CommandRoutingSetupITest.kt index 697cb29cc..6dae530af 100644 --- a/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/CommandRoutingSetupITest.kt +++ b/mc-java-routing-tests/src/test/kotlin/io/spine/tools/mc/java/routing/tests/CommandRoutingSetupITest.kt @@ -54,9 +54,9 @@ internal class CommandRoutingSetupITest { } ) - var lamp = context.readState(l1) // The first command is handled using the standard routing // via the first command field. + var lamp = context.readState(l1) lamp.state shouldBe State.OFF context.receivesCommand( @@ -66,8 +66,8 @@ internal class CommandRoutingSetupITest { } ) - lamp = context.readState(l1) // The command was handled via custom routing declared in the class. + lamp = context.readState(l1) lamp.state shouldBe State.ON } } From cec3e814d751f78fb7fd1410a25624a8ee1a8cee Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 16:48:43 +0000 Subject: [PATCH 21/31] Improve doc language --- .../kotlin/io/spine/given/home/HomeAutomationContext.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt b/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt index 21c3d3779..79d530bff 100644 --- a/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt +++ b/mc-java-routing-tests/src/testFixtures/kotlin/io/spine/given/home/HomeAutomationContext.kt @@ -88,7 +88,7 @@ class RoomProjection : Projection() { fun route(e: RoomEvent): RoomId = e.room /** - * The routing function by event class. + * The routing function accepting the event class. */ @Route fun routeMoved(e: DeviceMoved): Set = From 8d04894c0aa7a7758cb1ec281869a8dbfc57d67f Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 16:52:07 +0000 Subject: [PATCH 22/31] Improve function name --- .../io/spine/tools/mc/java/routing/proessor/CommonChecks.kt | 2 +- .../io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt index 38ee35398..3b3b8dac5 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt @@ -140,7 +140,7 @@ internal fun KSFunctionDeclaration.declaringClass(environment: Environment): Ent * * @return `true` if duplicating route functions found, `false` otherwise. */ -internal fun EntityClass.findDuplicatedRoutes( +internal fun EntityClass.hasDuplicatedRoutes( functions: List, environment: Environment ): Boolean { diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt index 3348543b0..347ce9192 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt @@ -270,7 +270,7 @@ internal sealed class RouteVisitor( * through [CommandRouteFun] ([F]) instances. * * The function also performs the check for - * [duplicated route functions][EntityClass.findDuplicatedRoutes] per declaring class. + * [duplicated route functions][EntityClass.hasDuplicatedRoutes] per declaring class. * If such duplicates are found, errors will be logged and all the functions of * the declaring class will not be processed by the visitor. * @@ -289,7 +289,7 @@ internal sealed class RouteVisitor( val routing = allFunctions.filterIsInstance() val grouped = routing.groupByClasses() grouped.forEach { (declaringClass, functions) -> - if (!declaringClass.findDuplicatedRoutes(functions, environment)) { + if (!declaringClass.hasDuplicatedRoutes(functions, environment)) { val v = createVisitor(functions) declaringClass.accept(v, Unit) v.writeFile() From 5035eda800e55bc2821db70ee3b4042cdc0140b7 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 16:53:38 +0000 Subject: [PATCH 23/31] Improve doc language --- .../io/spine/tools/mc/java/routing/proessor/EntityClass.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt index 2e7898254..c3a439795 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt @@ -46,7 +46,7 @@ internal class EntityClass( entityInterface: KSType ) { /** - * Makes the given visitor visit the class declaration. + * Applies the given visitor to the class declaration. */ fun accept(visitor: RouteVisitor<*>, data: Unit) { decl.accept(visitor, data) From 89d0d112f374d02089bade7842d5d6df13bb39ea Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 17:57:02 +0000 Subject: [PATCH 24/31] Fix package name Also: * Test message parameter name restriction. --- .../CommandRouteSignature.kt | 2 +- .../CommandRouteVisitor.kt | 2 +- .../{proessor => processor}/CommonChecks.kt | 6 +- .../{proessor => processor}/EntityClass.kt | 2 +- .../{proessor => processor}/Environment.kt | 2 +- .../EventRouteSignature.kt | 2 +- .../EventRouteVisitor.kt | 2 +- .../routing/{proessor => processor}/Exts.kt | 2 +- .../KSDeclarationExts.kt | 2 +- .../processor}/KSFunctionDeclarationExts.kt | 2 +- .../{proessor => processor}/KSTypeExts.kt | 2 +- .../MulticastRouteVisitor.kt | 17 +- .../{proessor => processor}/Qualifier.kt | 4 +- .../{proessor => processor}/RouteFun.kt | 3 +- .../{proessor => processor}/RouteProcessor.kt | 2 +- .../RouteProcessorProvider.kt | 2 +- .../{proessor => processor}/RouteSignature.kt | 5 +- .../{proessor => processor}/RouteVisitor.kt | 4 +- .../StateUpdateRouteSignature.kt | 2 +- .../StateUpdateRouteVisitor.kt | 2 +- .../{ => processor}/JavaRouteErrorSpec.kt | 4 +- .../routing/{ => processor}/JavaRouteSpec.kt | 2 +- .../{ => processor}/KotlinRouteErrorSpec.kt | 4 +- .../processor/MulticastRouteVisitorSpec.kt | 52 +++++ .../{ => processor}/RouteCompilationTest.kt | 3 +- .../tools/mc/java/routing/processor/Stubs.kt | 203 ++++++++++++++++++ .../java/routing/{ => processor}/TestExts.kt | 2 +- 27 files changed, 299 insertions(+), 38 deletions(-) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/CommandRouteSignature.kt (98%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/CommandRouteVisitor.kt (98%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/CommonChecks.kt (97%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/EntityClass.kt (98%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/Environment.kt (98%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/EventRouteSignature.kt (98%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/EventRouteVisitor.kt (97%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/Exts.kt (98%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/KSDeclarationExts.kt (96%) rename mc-java-routing/src/main/kotlin/{ => io/spine/tools/mc/java/routing/processor}/KSFunctionDeclarationExts.kt (97%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/KSTypeExts.kt (97%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/MulticastRouteVisitor.kt (85%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/Qualifier.kt (96%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/RouteFun.kt (98%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/RouteProcessor.kt (98%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/RouteProcessorProvider.kt (97%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/RouteSignature.kt (97%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/RouteVisitor.kt (99%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/StateUpdateRouteSignature.kt (97%) rename mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/{proessor => processor}/StateUpdateRouteVisitor.kt (97%) rename mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/{ => processor}/JavaRouteErrorSpec.kt (98%) rename mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/{ => processor}/JavaRouteSpec.kt (98%) rename mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/{ => processor}/KotlinRouteErrorSpec.kt (98%) create mode 100644 mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/MulticastRouteVisitorSpec.kt rename mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/{ => processor}/RouteCompilationTest.kt (96%) create mode 100644 mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/Stubs.kt rename mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/{ => processor}/TestExts.kt (98%) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteSignature.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/CommandRouteSignature.kt similarity index 98% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteSignature.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/CommandRouteSignature.kt index 0096930db..d031bb191 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteSignature.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/CommandRouteSignature.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.symbol.KSFunctionDeclaration import com.google.devtools.ksp.symbol.KSType diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/CommandRouteVisitor.kt similarity index 98% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteVisitor.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/CommandRouteVisitor.kt index b871c6991..9dddae7c0 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommandRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/CommandRouteVisitor.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.squareup.kotlinpoet.ksp.toClassName diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/CommonChecks.kt similarity index 97% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/CommonChecks.kt index 3b3b8dac5..ef56a7a9d 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/CommonChecks.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/CommonChecks.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.processing.KSPLogger import com.google.devtools.ksp.symbol.FunctionKind @@ -32,10 +32,8 @@ import com.google.devtools.ksp.symbol.KSClassDeclaration import com.google.devtools.ksp.symbol.KSFunctionDeclaration import com.google.devtools.ksp.symbol.Origin.JAVA import com.google.devtools.ksp.symbol.Origin.KOTLIN -import funRef import io.spine.server.entity.Entity -import io.spine.tools.mc.java.routing.proessor.RouteSignature.Companion.routeRef -import msg +import io.spine.tools.mc.java.routing.processor.RouteSignature.Companion.routeRef /** * Runs general usage checks for this function declaration. diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/EntityClass.kt similarity index 98% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/EntityClass.kt index c3a439795..4a39dd660 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EntityClass.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/EntityClass.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.symbol.ClassKind.CLASS import com.google.devtools.ksp.symbol.KSClassDeclaration diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Environment.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/Environment.kt similarity index 98% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Environment.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/Environment.kt index 5fbbc4043..b56402903 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Environment.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/Environment.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.processing.CodeGenerator import com.google.devtools.ksp.processing.KSPLogger diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteSignature.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/EventRouteSignature.kt similarity index 98% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteSignature.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/EventRouteSignature.kt index 55a4eaa38..4bf464d18 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteSignature.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/EventRouteSignature.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.symbol.KSFunctionDeclaration import com.google.devtools.ksp.symbol.KSType diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/EventRouteVisitor.kt similarity index 97% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/EventRouteVisitor.kt index 737b1af0a..b981ad42f 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/EventRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/EventRouteVisitor.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor /** * Creates a routing setup class for tuning diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Exts.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/Exts.kt similarity index 98% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Exts.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/Exts.kt index c28bff4ab..6b03eafbc 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Exts.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/Exts.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.processing.Resolver import com.google.devtools.ksp.symbol.KSType diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/KSDeclarationExts.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSDeclarationExts.kt similarity index 96% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/KSDeclarationExts.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSDeclarationExts.kt index 30af5da6e..829d08905 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/KSDeclarationExts.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSDeclarationExts.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.symbol.KSDeclaration diff --git a/mc-java-routing/src/main/kotlin/KSFunctionDeclarationExts.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSFunctionDeclarationExts.kt similarity index 97% rename from mc-java-routing/src/main/kotlin/KSFunctionDeclarationExts.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSFunctionDeclarationExts.kt index c2be3ac2e..8ed36c052 100644 --- a/mc-java-routing/src/main/kotlin/KSFunctionDeclarationExts.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSFunctionDeclarationExts.kt @@ -1,4 +1,4 @@ -/* +package io.spine.tools.mc.java.routing.processor/* * Copyright 2025, TeamDev. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/KSTypeExts.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSTypeExts.kt similarity index 97% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/KSTypeExts.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSTypeExts.kt index df4a81490..e07b59c41 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/KSTypeExts.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSTypeExts.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.symbol.ClassKind.INTERFACE import com.google.devtools.ksp.symbol.KSClassDeclaration diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/MulticastRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/MulticastRouteVisitor.kt similarity index 85% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/MulticastRouteVisitor.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/MulticastRouteVisitor.kt index 77d001a4d..dee80b8fc 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/MulticastRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/MulticastRouteVisitor.kt @@ -24,21 +24,23 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor +import com.google.common.annotations.VisibleForTesting import com.squareup.kotlinpoet.ksp.toClassName -import io.spine.tools.mc.java.routing.proessor.Environment.SetupType +import io.spine.tools.mc.java.routing.processor.Environment.SetupType /** * The base class for generators of the routing setup classes that * serve [multicast][io.spine.server.route.Multicast] routing schemas. * * @param F The type of route functions handled by the visitor. + * * @param setup The type of the routing setup class generated by this visitor. * @param functions The route functions declared in the [entityClass]. * @param environment The environment for code generation. */ -internal sealed class MulticastRouteVisitor( +internal abstract class MulticastRouteVisitor( setup: SetupType, functions: List, environment: Environment @@ -52,6 +54,14 @@ internal sealed class MulticastRouteVisitor( */ protected abstract val messageParameterName: String + @VisibleForTesting + internal fun checkMessageParameterName() { + check(messageParameterName != "c") { + "The value of the `messageParameterName` property cannot be `c`." + + " This name is reserved for context parameters." + } + } + /** * Adds an entry for the given function [fn] in the routing * [setup][io.spine.server.route.setup.RoutingSetup.setup] function @@ -68,6 +78,7 @@ internal sealed class MulticastRouteVisitor( * If a route function does not accept context, the lambdas would have only the `e` parameter. */ override fun addRoute(fn: F) { + checkMessageParameterName() val p = messageParameterName val params = if (fn.acceptsContext) "$p, c" else p val entryFn = if (fn.isUnicast) UNICAST_FUN_NAME else ROUTE_FUN_NAME diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Qualifier.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/Qualifier.kt similarity index 96% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Qualifier.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/Qualifier.kt index 1df88ecfa..8b2af3996 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/Qualifier.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/Qualifier.kt @@ -24,10 +24,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.symbol.KSFunctionDeclaration -import io.spine.tools.mc.java.routing.proessor.RouteSignature.Companion.routeRef +import io.spine.tools.mc.java.routing.processor.RouteSignature.Companion.routeRef /** * The helper class which transforms the incoming sequence with [functions] into diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteFun.kt similarity index 98% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteFun.kt index 63c42fb7e..c386dd7d2 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteFun.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteFun.kt @@ -24,14 +24,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.symbol.FileLocation import com.google.devtools.ksp.symbol.KSFunctionDeclaration import com.google.devtools.ksp.symbol.KSType import com.squareup.kotlinpoet.ClassName import com.squareup.kotlinpoet.ksp.toClassName -import shortName /** * Provides information about a route function detected in the [declaringClass] diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteProcessor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteProcessor.kt similarity index 98% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteProcessor.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteProcessor.kt index aa12781f6..00584332c 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteProcessor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteProcessor.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.processing.CodeGenerator import com.google.devtools.ksp.processing.KSPLogger diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteProcessorProvider.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteProcessorProvider.kt similarity index 97% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteProcessorProvider.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteProcessorProvider.kt index c47fba0dd..f62b0cfe0 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteProcessorProvider.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteProcessorProvider.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.auto.service.AutoService import com.google.devtools.ksp.processing.SymbolProcessor diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteSignature.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteSignature.kt similarity index 97% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteSignature.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteSignature.kt index cb28abfad..3cb9aaf3d 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteSignature.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteSignature.kt @@ -24,16 +24,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.symbol.KSFunctionDeclaration import com.google.devtools.ksp.symbol.KSType import com.google.errorprone.annotations.OverridingMethodsMustInvokeSuper -import funRef import io.spine.core.SignalContext import io.spine.server.route.Route import io.spine.string.simply -import io.spine.tools.mc.java.routing.proessor.RouteSignature.Companion.qualify +import io.spine.tools.mc.java.routing.processor.RouteSignature.Companion.qualify import io.spine.type.KnownMessage /** diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteVisitor.kt similarity index 99% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteVisitor.kt index 347ce9192..666219320 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/RouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteVisitor.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.auto.service.AutoService import com.google.devtools.ksp.processing.Dependencies @@ -50,7 +50,7 @@ import com.squareup.kotlinpoet.ksp.writeTo import io.spine.server.entity.Entity import io.spine.string.Indent import io.spine.tools.mc.java.GeneratedAnnotation -import io.spine.tools.mc.java.routing.proessor.Environment.SetupType +import io.spine.tools.mc.java.routing.processor.Environment.SetupType /** * The base class for code generators implementing routing setup classes diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteSignature.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/StateUpdateRouteSignature.kt similarity index 97% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteSignature.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/StateUpdateRouteSignature.kt index f333d2aa0..56e804368 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteSignature.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/StateUpdateRouteSignature.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor import com.google.devtools.ksp.symbol.KSFunctionDeclaration import com.google.devtools.ksp.symbol.KSType diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/StateUpdateRouteVisitor.kt similarity index 97% rename from mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt rename to mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/StateUpdateRouteVisitor.kt index 4dc59ca08..2a4ad9db3 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/proessor/StateUpdateRouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/StateUpdateRouteVisitor.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing.proessor +package io.spine.tools.mc.java.routing.processor /** * Creates a routing setup class for tuning diff --git a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/JavaRouteErrorSpec.kt b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/JavaRouteErrorSpec.kt similarity index 98% rename from mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/JavaRouteErrorSpec.kt rename to mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/JavaRouteErrorSpec.kt index 7ccdb67b0..782507a49 100644 --- a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/JavaRouteErrorSpec.kt +++ b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/JavaRouteErrorSpec.kt @@ -29,7 +29,7 @@ "MissingPackageInfo" /* don't need them for these tests. */ ) -package io.spine.tools.mc.java.routing +package io.spine.tools.mc.java.routing.processor import com.tschuchort.compiletesting.KotlinCompilation.ExitCode.COMPILATION_ERROR import io.kotest.matchers.shouldBe @@ -41,7 +41,7 @@ import io.spine.server.entity.Entity import io.spine.server.procman.ProcessManager import io.spine.server.projection.Projection import io.spine.string.simply -import io.spine.tools.mc.java.routing.proessor.RouteSignature.Companion.routeRef +import io.spine.tools.mc.java.routing.processor.RouteSignature.Companion.routeRef import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test diff --git a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/JavaRouteSpec.kt b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/JavaRouteSpec.kt similarity index 98% rename from mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/JavaRouteSpec.kt rename to mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/JavaRouteSpec.kt index ba5d29db1..c7c93131c 100644 --- a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/JavaRouteSpec.kt +++ b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/JavaRouteSpec.kt @@ -29,7 +29,7 @@ "MissingPackageInfo" /* don't need them for these tests. */ ) -package io.spine.tools.mc.java.routing +package io.spine.tools.mc.java.routing.processor import com.tschuchort.compiletesting.KotlinCompilation.ExitCode import io.kotest.matchers.shouldBe diff --git a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/KotlinRouteErrorSpec.kt b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/KotlinRouteErrorSpec.kt similarity index 98% rename from mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/KotlinRouteErrorSpec.kt rename to mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/KotlinRouteErrorSpec.kt index c169f583d..1e94f1797 100644 --- a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/KotlinRouteErrorSpec.kt +++ b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/KotlinRouteErrorSpec.kt @@ -29,14 +29,14 @@ "MissingPackageInfo" /* don't need them for these tests. */ ) -package io.spine.tools.mc.java.routing +package io.spine.tools.mc.java.routing.processor import com.tschuchort.compiletesting.KotlinCompilation.ExitCode import com.tschuchort.compiletesting.KotlinCompilation.ExitCode.COMPILATION_ERROR import io.kotest.matchers.shouldBe import io.kotest.matchers.string.shouldContain import io.kotest.matchers.string.shouldNotContain -import io.spine.tools.mc.java.routing.proessor.RouteSignature.Companion.routeRef +import io.spine.tools.mc.java.routing.processor.RouteSignature.Companion.routeRef import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test diff --git a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/MulticastRouteVisitorSpec.kt b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/MulticastRouteVisitorSpec.kt new file mode 100644 index 000000000..a21eb62df --- /dev/null +++ b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/MulticastRouteVisitorSpec.kt @@ -0,0 +1,52 @@ +/* + * Copyright 2025, TeamDev. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.tools.mc.java.routing.processor + +import org.junit.jupiter.api.DisplayName +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows + +@DisplayName("`MulticastRouteVisitor` should") +internal class MulticastRouteVisitorSpec { + + @Test + fun `prohibit 'c' as the message parameter name`() { + assertThrows { + StubVisitor("c", "SomeSuffix").checkMessageParameterName() + } + } +} + +private class StubVisitor( + override val messageParameterName: String, + override val classNameSuffix: String, +) : MulticastRouteVisitor( + stubEnvironment.eventRoutingSetup, + listOf(), + stubEnvironment +) + diff --git a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/RouteCompilationTest.kt b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/RouteCompilationTest.kt similarity index 96% rename from mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/RouteCompilationTest.kt rename to mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/RouteCompilationTest.kt index 70244b8e4..5c7e45c93 100644 --- a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/RouteCompilationTest.kt +++ b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/RouteCompilationTest.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing +package io.spine.tools.mc.java.routing.processor import com.google.auto.service.AutoService import com.google.protobuf.MessageOrBuilder @@ -35,7 +35,6 @@ import io.spine.core.EventContext import io.spine.given.devices.Device import io.spine.logging.testing.ConsoleTap import io.spine.server.route.Route -import io.spine.tools.mc.java.routing.proessor.RouteProcessorProvider import io.spine.validate.ValidatingBuilder import kotlin.collections.plus import org.junit.jupiter.api.BeforeAll diff --git a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/Stubs.kt b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/Stubs.kt new file mode 100644 index 000000000..d1309dc06 --- /dev/null +++ b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/Stubs.kt @@ -0,0 +1,203 @@ +/* + * Copyright 2025, TeamDev. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package io.spine.tools.mc.java.routing.processor + +import com.google.devtools.ksp.KspExperimental +import com.google.devtools.ksp.processing.CodeGenerator +import com.google.devtools.ksp.processing.Dependencies +import com.google.devtools.ksp.processing.KSBuiltIns +import com.google.devtools.ksp.processing.KSPLogger +import com.google.devtools.ksp.processing.Resolver +import com.google.devtools.ksp.symbol.KSAnnotated +import com.google.devtools.ksp.symbol.KSClassDeclaration +import com.google.devtools.ksp.symbol.KSDeclaration +import com.google.devtools.ksp.symbol.KSDeclarationContainer +import com.google.devtools.ksp.symbol.KSFile +import com.google.devtools.ksp.symbol.KSFunctionDeclaration +import com.google.devtools.ksp.symbol.KSName +import com.google.devtools.ksp.symbol.KSNode +import com.google.devtools.ksp.symbol.KSPropertyAccessor +import com.google.devtools.ksp.symbol.KSPropertyDeclaration +import com.google.devtools.ksp.symbol.KSType +import com.google.devtools.ksp.symbol.KSTypeArgument +import com.google.devtools.ksp.symbol.KSTypeReference +import com.google.devtools.ksp.symbol.Modifier +import com.google.devtools.ksp.symbol.Variance +import java.io.File +import java.io.OutputStream + +/** + * A stub instance of [Environment] which can be used only as a parameter for no-op visitors. + */ +internal val stubEnvironment = Environment(NotResolver(), NotLogger(), NotCodeGenerator()) + +private fun notImplemented(): Nothing = TODO("Not implemented.") + +/** + * The stub implementation of [Resolver] which throws [NotImplementedError] from all functions. + */ +private class NotResolver : Resolver { + + override val builtIns: KSBuiltIns + get() = notImplemented() + + override fun createKSTypeReferenceFromKSType(type: KSType): KSTypeReference = notImplemented() + + @KspExperimental + override fun effectiveJavaModifiers(declaration: KSDeclaration): Set = + notImplemented() + + override fun getAllFiles(): Sequence = notImplemented() + + override fun getClassDeclarationByName(name: KSName): KSClassDeclaration? = notImplemented() + + @KspExperimental + override fun getDeclarationsFromPackage(packageName: String): Sequence = + notImplemented() + + @KspExperimental + override fun getDeclarationsInSourceOrder(container: KSDeclarationContainer): Sequence = + notImplemented() + + override fun getFunctionDeclarationsByName( + name: KSName, + includeTopLevel: Boolean + ): Sequence = notImplemented() + + @KspExperimental + override fun getJavaWildcard(reference: KSTypeReference): KSTypeReference = notImplemented() + + @KspExperimental + override fun getJvmCheckedException(function: KSFunctionDeclaration): Sequence = + notImplemented() + + @KspExperimental + override fun getJvmCheckedException(accessor: KSPropertyAccessor): Sequence = + notImplemented() + + @KspExperimental + override fun getJvmName(declaration: KSFunctionDeclaration): String? = notImplemented() + + @KspExperimental + override fun getJvmName(accessor: KSPropertyAccessor): String? = notImplemented() + + override fun getKSNameFromString(name: String): KSName = notImplemented() + + override fun getNewFiles(): Sequence = notImplemented() + + @KspExperimental + override fun getOwnerJvmClassName(declaration: KSFunctionDeclaration): String? = + notImplemented() + + @KspExperimental + override fun getOwnerJvmClassName(declaration: KSPropertyDeclaration): String? = + notImplemented() + + override fun getPropertyDeclarationByName( + name: KSName, + includeTopLevel: Boolean + ): KSPropertyDeclaration? = notImplemented() + + override fun getSymbolsWithAnnotation( + annotationName: String, + inDepth: Boolean + ): Sequence = notImplemented() + + override fun getTypeArgument(typeRef: KSTypeReference, variance: Variance): KSTypeArgument = + notImplemented() + + @KspExperimental + override fun isJavaRawType(type: KSType): Boolean = notImplemented() + + @KspExperimental + override fun mapJavaNameToKotlin(javaName: KSName): KSName? = notImplemented() + + @KspExperimental + override fun mapKotlinNameToJava(kotlinName: KSName): KSName? = notImplemented() + + @KspExperimental + override fun mapToJvmSignature(declaration: KSDeclaration): String? = notImplemented() + + override fun overrides(overrider: KSDeclaration, overridee: KSDeclaration): Boolean = + notImplemented() + + override fun overrides( + overrider: KSDeclaration, + overridee: KSDeclaration, + containingClass: KSClassDeclaration + ): Boolean = notImplemented() +} + +/** + * The stub implementation of [KSPLogger] which throws [NotImplementedError] from all functions. + */ +private class NotLogger : KSPLogger { + override fun error(message: String, symbol: KSNode?): Unit = notImplemented() + override fun exception(e: Throwable): Unit = notImplemented() + override fun info(message: String, symbol: KSNode?): Unit = notImplemented() + override fun logging(message: String, symbol: KSNode?): Unit = notImplemented() + override fun warn(message: String, symbol: KSNode?): Unit = notImplemented() +} + +/** + * The stub implementation of [CodeGenerator] which throws [NotImplementedError] from all functions. + */ +private class NotCodeGenerator : CodeGenerator { + + override val generatedFile: Collection + get() = notImplemented() + + override fun associate( + sources: List, + packageName: String, + fileName: String, + extensionName: String + ): Unit = notImplemented() + + override fun associateByPath(sources: List, path: String, extensionName: String): Unit = + notImplemented() + + override fun associateWithClasses( + classes: List, + packageName: String, + fileName: String, + extensionName: String + ): Unit = notImplemented() + + override fun createNewFile( + dependencies: Dependencies, + packageName: String, + fileName: String, + extensionName: String + ): OutputStream = notImplemented() + + override fun createNewFileByPath( + dependencies: Dependencies, + path: String, + extensionName: String + ): OutputStream = notImplemented() +} diff --git a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/TestExts.kt b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/TestExts.kt similarity index 98% rename from mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/TestExts.kt rename to mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/TestExts.kt index 4f5510576..3370041ba 100644 --- a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/TestExts.kt +++ b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/TestExts.kt @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.tools.mc.java.routing +package io.spine.tools.mc.java.routing.processor import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile From f6bb9a63d606b5d5457ec65f22404a991c427ad7 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 17:59:32 +0000 Subject: [PATCH 25/31] Update config --- .../kotlin/io/spine/dependency/lib/Kotlin.kt | 2 +- .../dependency/test/KotlinCompileTesting.kt | 2 +- .../spine/gradle/report/pom/PomGenerator.kt | 23 ++++++++++--------- config | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt index 21417f4ef..8dabdb885 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt @@ -1,5 +1,5 @@ /* - * Copyright 2024, TeamDev. All rights reserved. + * Copyright 2025, TeamDev. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/test/KotlinCompileTesting.kt b/buildSrc/src/main/kotlin/io/spine/dependency/test/KotlinCompileTesting.kt index 4da9bcf64..d743985c6 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/test/KotlinCompileTesting.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/test/KotlinCompileTesting.kt @@ -27,7 +27,7 @@ package io.spine.dependency.test /** - * A library for in-process compilation of Kotlin and Java code. + * A library for in-process compilation of Kotlin and Java code compilation. * * @see GitHub repo */ diff --git a/buildSrc/src/main/kotlin/io/spine/gradle/report/pom/PomGenerator.kt b/buildSrc/src/main/kotlin/io/spine/gradle/report/pom/PomGenerator.kt index ff70b82fa..9144e2f21 100644 --- a/buildSrc/src/main/kotlin/io/spine/gradle/report/pom/PomGenerator.kt +++ b/buildSrc/src/main/kotlin/io/spine/gradle/report/pom/PomGenerator.kt @@ -1,5 +1,5 @@ /* - * Copyright 2024, TeamDev. All rights reserved. + * Copyright 2025, TeamDev. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,20 +75,21 @@ object PomGenerator { plugin(BasePlugin::class.java) } - val task = project.tasks.create("generatePom") - task.doLast { - val pomFile = project.projectDir.resolve("pom.xml") - project.delete(pomFile) + val task = project.tasks.register("generatePom") { + doLast { + val pomFile = project.projectDir.resolve("pom.xml") + project.delete(pomFile) - val projectData = project.metadata() - val writer = PomXmlWriter(projectData) - writer.writeTo(pomFile) + val projectData = project.metadata() + val writer = PomXmlWriter(projectData) + writer.writeTo(pomFile) + } + + val assembleTask = project.tasks.findByName("assemble")!! + dependsOn(assembleTask) } val buildTask = project.tasks.findByName("build")!! buildTask.finalizedBy(task) - - val assembleTask = project.tasks.findByName("assemble")!! - task.dependsOn(assembleTask) } } diff --git a/config b/config index d3f2e696f..8bc443da2 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit d3f2e696f3de878d19f7c635107620becb7829f1 +Subproject commit 8bc443da2ac11dbe7dbdf44f5fb5d54cfa7bb27a From c0c03e8e173518fb127f501dea5e1cb54dd2aafe Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 18:07:30 +0000 Subject: [PATCH 26/31] Suppress warnings --- .../io/spine/tools/mc/java/routing/processor/Stubs.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/Stubs.kt b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/Stubs.kt index d1309dc06..20bdb0b87 100644 --- a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/Stubs.kt +++ b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/Stubs.kt @@ -60,6 +60,7 @@ private fun notImplemented(): Nothing = TODO("Not implemented.") /** * The stub implementation of [Resolver] which throws [NotImplementedError] from all functions. */ +@Suppress("TooManyFunctions") private class NotResolver : Resolver { override val builtIns: KSBuiltIns @@ -80,8 +81,9 @@ private class NotResolver : Resolver { notImplemented() @KspExperimental - override fun getDeclarationsInSourceOrder(container: KSDeclarationContainer): Sequence = - notImplemented() + override fun getDeclarationsInSourceOrder( + container: KSDeclarationContainer + ): Sequence = notImplemented() override fun getFunctionDeclarationsByName( name: KSName, From 84455e594dee0b1ef7d6038d22ec5c4d8d488711 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 18:16:08 +0000 Subject: [PATCH 27/31] Improve doc wording --- .../spine/tools/mc/java/routing/processor/RouteVisitor.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteVisitor.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteVisitor.kt index 666219320..7f0a19619 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteVisitor.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/RouteVisitor.kt @@ -53,8 +53,10 @@ import io.spine.tools.mc.java.GeneratedAnnotation import io.spine.tools.mc.java.routing.processor.Environment.SetupType /** - * The base class for code generators implementing routing setup classes - * adding calls to the type of route functions specified by the generic parameter [F]. + * The base class for code generators implementing routing setup classes. + * + * The type of the generated setup class is determined by the [setup] property. + * The type of the generated route functions is specified by the generic parameter [F]. * * The visitor generates a class named after the class declaring routing function(s) * using the pattern: [entityClass] + [classNameSuffix]. The class is generated From a04627aaab3a5a5b1c267d6e33b84775997c252a Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 18:16:15 +0000 Subject: [PATCH 28/31] Update dependency reports --- dependencies.md | 38 +++++++++++++++++++------------------- pom.xml | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dependencies.md b/dependencies.md index e2f318206..fcd067af1 100644 --- a/dependencies.md +++ b/dependencies.md @@ -1054,7 +1054,7 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:31 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:53 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -1977,7 +1977,7 @@ This report was generated on **Wed Feb 26 15:05:31 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:53 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -2908,7 +2908,7 @@ This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:53 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -3724,7 +3724,7 @@ This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:53 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -4647,7 +4647,7 @@ This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:54 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -5436,7 +5436,7 @@ This report was generated on **Wed Feb 26 15:05:32 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:33 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:54 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -6359,7 +6359,7 @@ This report was generated on **Wed Feb 26 15:05:33 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:33 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:54 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -7148,7 +7148,7 @@ This report was generated on **Wed Feb 26 15:05:33 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:33 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:54 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -8079,7 +8079,7 @@ This report was generated on **Wed Feb 26 15:05:33 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:54 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -8868,7 +8868,7 @@ This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:55 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -9799,7 +9799,7 @@ This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:55 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -10588,7 +10588,7 @@ This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:55 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -11590,7 +11590,7 @@ This report was generated on **Wed Feb 26 15:05:34 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:55 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -12576,7 +12576,7 @@ This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:56 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -13398,7 +13398,7 @@ This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:56 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -14329,7 +14329,7 @@ This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:56 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -15118,7 +15118,7 @@ This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:56 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -16049,7 +16049,7 @@ This report was generated on **Wed Feb 26 15:05:35 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:36 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Wed Feb 26 18:12:56 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -16838,4 +16838,4 @@ This report was generated on **Wed Feb 26 15:05:36 WET 2025** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Wed Feb 26 15:05:36 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Wed Feb 26 18:12:57 WET 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2aecd5501..841152690 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ all modules and does not describe the project structure per-subproject. io.spine spine-base - 2.0.0-SNAPSHOT.243 + 2.0.0-SNAPSHOT.244 compile From 336f3515e00e410c25f01cebba232df35cf916b1 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 18:18:50 +0000 Subject: [PATCH 29/31] Improve comment language --- .../tools/mc/java/routing/processor/KotlinRouteErrorSpec.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/KotlinRouteErrorSpec.kt b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/KotlinRouteErrorSpec.kt index 1e94f1797..c2b471cc6 100644 --- a/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/KotlinRouteErrorSpec.kt +++ b/mc-java-routing/src/test/kotlin/io/spine/tools/mc/java/routing/processor/KotlinRouteErrorSpec.kt @@ -145,7 +145,7 @@ internal class KotlinRouteErrorSpec : RouteCompilationTest() { it shouldContain "`route(StatusReported)`" it shouldContain "`routeAgain(StatusReported, EventContext)`" it shouldContain "Please have only one function per routed message class." - // Not duplicated. + // The route for this event is not duplicated. it shouldNotContain "DeviceRegistered" } } From 1b57492a6601090796957c665eec80cc4b081b5f Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 18:33:41 +0000 Subject: [PATCH 30/31] Remove redundant (c) statement --- .../mc/java/routing/processor/KSFunctionDeclarationExts.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSFunctionDeclarationExts.kt b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSFunctionDeclarationExts.kt index 8ed36c052..8824eec1a 100644 --- a/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSFunctionDeclarationExts.kt +++ b/mc-java-routing/src/main/kotlin/io/spine/tools/mc/java/routing/processor/KSFunctionDeclarationExts.kt @@ -1,4 +1,4 @@ -package io.spine.tools.mc.java.routing.processor/* +/* * Copyright 2025, TeamDev. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +24,8 @@ package io.spine.tools.mc.java.routing.processor/* * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +package io.spine.tools.mc.java.routing.processor + import com.google.devtools.ksp.symbol.KSFunctionDeclaration import com.google.devtools.ksp.symbol.Origin.JAVA import com.google.devtools.ksp.symbol.Origin.JAVA_LIB From 3e73626a740d5b803c8b5f57038dd5aaba9d21eb Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 26 Feb 2025 18:35:02 +0000 Subject: [PATCH 31/31] Remove redundant word in docs --- .../kotlin/io/spine/dependency/test/KotlinCompileTesting.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/test/KotlinCompileTesting.kt b/buildSrc/src/main/kotlin/io/spine/dependency/test/KotlinCompileTesting.kt index d743985c6..4da9bcf64 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/test/KotlinCompileTesting.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/test/KotlinCompileTesting.kt @@ -27,7 +27,7 @@ package io.spine.dependency.test /** - * A library for in-process compilation of Kotlin and Java code compilation. + * A library for in-process compilation of Kotlin and Java code. * * @see GitHub repo */