Skip to content

Commit 7812684

Browse files
Merge pull request #153 from SpineEventEngine/utilize-expressions
Apply typed `Expression` for `(set_once)` feature
2 parents 583c1dd + cd08060 commit 7812684

30 files changed

+728
-430
lines changed

buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ object McJava {
4747
/**
4848
* The version to be used for integration tests.
4949
*/
50-
const val version = "2.0.0-SNAPSHOT.254"
50+
const val version = "2.0.0-SNAPSHOT.256"
5151

5252
/**
5353
* The ID of the Gradle plugin.

buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ object ProtoData {
7373
* The version of ProtoData dependencies.
7474
*/
7575
val version: String
76-
private const val fallbackVersion = "0.67.0"
76+
private const val fallbackVersion = "0.69.0"
7777

7878
/**
7979
* The distinct version of ProtoData used by other build tools.

dependencies.md

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22

3-
# Dependencies of `io.spine.validation:spine-validation-java:2.0.0-SNAPSHOT.172`
3+
# Dependencies of `io.spine.validation:spine-validation-java:2.0.0-SNAPSHOT.173`
44

55
## Runtime
66
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3.
@@ -852,12 +852,12 @@
852852

853853
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
854854

855-
This report was generated on **Fri Nov 15 20:47:50 WET 2024** 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).
855+
This report was generated on **Mon Nov 25 12:40:51 CET 2024** 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).
856856

857857

858858

859859

860-
# Dependencies of `io.spine.validation:spine-validation-java-bundle:2.0.0-SNAPSHOT.172`
860+
# Dependencies of `io.spine.validation:spine-validation-java-bundle:2.0.0-SNAPSHOT.173`
861861

862862
## Runtime
863863
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3.
@@ -1709,12 +1709,12 @@ This report was generated on **Fri Nov 15 20:47:50 WET 2024** using [Gradle-Lice
17091709

17101710
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
17111711

1712-
This report was generated on **Fri Nov 15 20:47:50 WET 2024** 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).
1712+
This report was generated on **Mon Nov 25 12:40:53 CET 2024** 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).
17131713

17141714

17151715

17161716

1717-
# Dependencies of `io.spine.validation:spine-validation-java-runtime:2.0.0-SNAPSHOT.172`
1717+
# Dependencies of `io.spine.validation:spine-validation-java-runtime:2.0.0-SNAPSHOT.173`
17181718

17191719
## Runtime
17201720
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -2371,12 +2371,12 @@ This report was generated on **Fri Nov 15 20:47:50 WET 2024** using [Gradle-Lice
23712371

23722372
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
23732373

2374-
This report was generated on **Fri Nov 15 20:47:50 WET 2024** 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).
2374+
This report was generated on **Mon Nov 25 12:40:53 CET 2024** 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).
23752375

23762376

23772377

23782378

2379-
# Dependencies of `io.spine.validation:spine-validation-java-runtime-bundle:2.0.0-SNAPSHOT.172`
2379+
# Dependencies of `io.spine.validation:spine-validation-java-runtime-bundle:2.0.0-SNAPSHOT.173`
23802380

23812381
## Runtime
23822382
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -3022,12 +3022,12 @@ This report was generated on **Fri Nov 15 20:47:50 WET 2024** using [Gradle-Lice
30223022

30233023
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
30243024

3025-
This report was generated on **Fri Nov 15 20:47:51 WET 2024** 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).
3025+
This report was generated on **Mon Nov 25 12:40:54 CET 2024** 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).
30263026

30273027

30283028

30293029

3030-
# Dependencies of `io.spine.validation:spine-validation-java-tests:2.0.0-SNAPSHOT.172`
3030+
# Dependencies of `io.spine.validation:spine-validation-java-tests:2.0.0-SNAPSHOT.173`
30313031

30323032
## Runtime
30333033
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3.
@@ -3947,12 +3947,12 @@ This report was generated on **Fri Nov 15 20:47:51 WET 2024** using [Gradle-Lice
39473947

39483948
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
39493949

3950-
This report was generated on **Fri Nov 15 20:47:51 WET 2024** 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).
3950+
This report was generated on **Mon Nov 25 12:40:55 CET 2024** 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).
39513951

39523952

39533953

39543954

3955-
# Dependencies of `io.spine.validation:spine-validation-model:2.0.0-SNAPSHOT.172`
3955+
# Dependencies of `io.spine.validation:spine-validation-model:2.0.0-SNAPSHOT.173`
39563956

39573957
## Runtime
39583958
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3.
@@ -4807,12 +4807,12 @@ This report was generated on **Fri Nov 15 20:47:51 WET 2024** using [Gradle-Lice
48074807

48084808
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
48094809

4810-
This report was generated on **Fri Nov 15 20:47:52 WET 2024** 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).
4810+
This report was generated on **Mon Nov 25 12:40:56 CET 2024** 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).
48114811

48124812

48134813

48144814

4815-
# Dependencies of `io.spine.validation:spine-validation-proto:2.0.0-SNAPSHOT.172`
4815+
# Dependencies of `io.spine.validation:spine-validation-proto:2.0.0-SNAPSHOT.173`
48164816

48174817
## Runtime
48184818
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3.
@@ -5701,12 +5701,12 @@ This report was generated on **Fri Nov 15 20:47:52 WET 2024** using [Gradle-Lice
57015701

57025702
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
57035703

5704-
This report was generated on **Fri Nov 15 20:47:52 WET 2024** 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).
5704+
This report was generated on **Mon Nov 25 12:40:57 CET 2024** 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).
57055705

57065706

57075707

57085708

5709-
# Dependencies of `io.spine.validation:spine-validation-consumer:2.0.0-SNAPSHOT.172`
5709+
# Dependencies of `io.spine.validation:spine-validation-consumer:2.0.0-SNAPSHOT.173`
57105710

57115711
## Runtime
57125712
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3.
@@ -6574,12 +6574,12 @@ This report was generated on **Fri Nov 15 20:47:52 WET 2024** using [Gradle-Lice
65746574

65756575
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
65766576

6577-
This report was generated on **Fri Nov 15 20:47:52 WET 2024** 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).
6577+
This report was generated on **Mon Nov 25 12:40:57 CET 2024** 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).
65786578

65796579

65806580

65816581

6582-
# Dependencies of `io.spine.validation:spine-validation-consumer-dependency:2.0.0-SNAPSHOT.172`
6582+
# Dependencies of `io.spine.validation:spine-validation-consumer-dependency:2.0.0-SNAPSHOT.173`
65836583

65846584
## Runtime
65856585
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -7327,12 +7327,12 @@ This report was generated on **Fri Nov 15 20:47:52 WET 2024** using [Gradle-Lice
73277327

73287328
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
73297329

7330-
This report was generated on **Fri Nov 15 20:47:52 WET 2024** 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).
7330+
This report was generated on **Mon Nov 25 12:40:58 CET 2024** 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).
73317331

73327332

73337333

73347334

7335-
# Dependencies of `io.spine.validation:spine-validation-extensions:2.0.0-SNAPSHOT.172`
7335+
# Dependencies of `io.spine.validation:spine-validation-extensions:2.0.0-SNAPSHOT.173`
73367336

73377337
## Runtime
73387338
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3.
@@ -8229,12 +8229,12 @@ This report was generated on **Fri Nov 15 20:47:52 WET 2024** using [Gradle-Lice
82298229

82308230
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
82318231

8232-
This report was generated on **Fri Nov 15 20:47:52 WET 2024** 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).
8232+
This report was generated on **Mon Nov 25 12:40:58 CET 2024** 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).
82338233

82348234

82358235

82368236

8237-
# Dependencies of `io.spine.validation:spine-validation-runtime:2.0.0-SNAPSHOT.172`
8237+
# Dependencies of `io.spine.validation:spine-validation-runtime:2.0.0-SNAPSHOT.173`
82388238

82398239
## Runtime
82408240
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -8985,12 +8985,12 @@ This report was generated on **Fri Nov 15 20:47:52 WET 2024** using [Gradle-Lice
89858985

89868986
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
89878987

8988-
This report was generated on **Fri Nov 15 20:47:53 WET 2024** 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).
8988+
This report was generated on **Mon Nov 25 12:40:59 CET 2024** 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).
89898989

89908990

89918991

89928992

8993-
# Dependencies of `io.spine.validation:spine-validation-validating:2.0.0-SNAPSHOT.172`
8993+
# Dependencies of `io.spine.validation:spine-validation-validating:2.0.0-SNAPSHOT.173`
89948994

89958995
## Runtime
89968996
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -9745,12 +9745,12 @@ This report was generated on **Fri Nov 15 20:47:53 WET 2024** using [Gradle-Lice
97459745

97469746
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
97479747

9748-
This report was generated on **Fri Nov 15 20:47:53 WET 2024** 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).
9748+
This report was generated on **Mon Nov 25 12:40:59 CET 2024** 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).
97499749

97509750

97519751

97529752

9753-
# Dependencies of `io.spine.validation:spine-validation-vanilla:2.0.0-SNAPSHOT.172`
9753+
# Dependencies of `io.spine.validation:spine-validation-vanilla:2.0.0-SNAPSHOT.173`
97549754

97559755
## Runtime
97569756
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
@@ -10496,12 +10496,12 @@ This report was generated on **Fri Nov 15 20:47:53 WET 2024** using [Gradle-Lice
1049610496

1049710497
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
1049810498

10499-
This report was generated on **Fri Nov 15 20:47:53 WET 2024** 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).
10499+
This report was generated on **Mon Nov 25 12:41:00 CET 2024** 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).
1050010500

1050110501

1050210502

1050310503

10504-
# Dependencies of `io.spine.validation:spine-validation-configuration:2.0.0-SNAPSHOT.172`
10504+
# Dependencies of `io.spine.validation:spine-validation-configuration:2.0.0-SNAPSHOT.173`
1050510505

1050610506
## Runtime
1050710507
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3.
@@ -11366,12 +11366,12 @@ This report was generated on **Fri Nov 15 20:47:53 WET 2024** using [Gradle-Lice
1136611366

1136711367
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
1136811368

11369-
This report was generated on **Fri Nov 15 20:47:53 WET 2024** 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).
11369+
This report was generated on **Mon Nov 25 12:41:00 CET 2024** 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).
1137011370

1137111371

1137211372

1137311373

11374-
# Dependencies of `io.spine.validation:spine-validation-context:2.0.0-SNAPSHOT.172`
11374+
# Dependencies of `io.spine.validation:spine-validation-context:2.0.0-SNAPSHOT.173`
1137511375

1137611376
## Runtime
1137711377
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.15.3.
@@ -12236,4 +12236,4 @@ This report was generated on **Fri Nov 15 20:47:53 WET 2024** using [Gradle-Lice
1223612236

1223712237
The dependencies distributed under several licenses, are used according their commercial-use-friendly license.
1223812238

12239-
This report was generated on **Fri Nov 15 20:47:53 WET 2024** 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).
12239+
This report was generated on **Mon Nov 25 12:41:01 CET 2024** 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).

java-tests/consumer/build.gradle.kts

-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import io.spine.dependency.local.Spine
2828
import io.spine.gradle.protobuf.configureIdea
2929
import io.spine.gradle.protobuf.excludeProtocOutput
3030
import io.spine.gradle.protobuf.makeDirsForIdeaModule
31-
import io.spine.gradle.protobuf.setupDescriptorSetFileCreation
3231
import io.spine.protodata.gradle.plugin.CreateSettingsDirectory
3332
import io.spine.protodata.gradle.plugin.LaunchProtoData
3433
import io.spine.util.theOnly
@@ -44,7 +43,6 @@ protoData {
4443

4544
protobuf {
4645
generateProtoTasks.all().configureEach {
47-
setupDescriptorSetFileCreation()
4846
excludeProtocOutput()
4947
makeDirsForIdeaModule()
5048
}

java/src/main/kotlin/io/spine/validation/java/CodeGenerator.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ internal abstract class CodeGenerator(
9393
*
9494
* The expression evaluates to `true` if there is a violation and to `false` otherwise.
9595
*/
96-
abstract fun condition(): Expression
96+
abstract fun condition(): Expression<Boolean>
9797

9898
/**
9999
* Forms an error message for the found violation.

java/src/main/kotlin/io/spine/validation/java/CompositeRuleGenerators.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import com.squareup.javapoet.CodeBlock
3030
import io.spine.protobuf.isNotDefault
3131
import io.spine.protodata.ast.Field
3232
import io.spine.protodata.java.Expression
33-
import io.spine.protodata.java.Literal
3433
import io.spine.tools.java.codeBlock
3534
import io.spine.validation.ErrorMessage
3635
import io.spine.validation.LogicalOperator.AND
@@ -65,12 +64,12 @@ internal class CompositeRuleGenerator(ctx: GenerationContext) : CodeGenerator(ct
6564
override val canGenerate: Boolean =
6665
left.canGenerate && right.canGenerate
6766

68-
override fun condition(): Expression = with(ctx) {
67+
override fun condition(): Expression<Boolean> = with(ctx) {
6968
val composite = rule.composite
7069
val left = left.condition()
7170
val right = right.condition()
7271
val binaryOp = BOOLEAN_OPS[composite.operator]!!
73-
return Literal(binaryOp(left.toCode(), right.toCode()))
72+
return Expression(binaryOp(left.toCode(), right.toCode()))
7473
}
7574

7675
override fun error(): ErrorMessage {
@@ -95,7 +94,7 @@ internal class CompositeRuleGenerator(ctx: GenerationContext) : CodeGenerator(ct
9594

9695
override fun createViolation(): CodeBlock {
9796
val rule = ctx.rule.composite
98-
val accessor: Expression?
97+
val accessor: Expression<*>?
9998
val field: Field?
10099
if (rule.hasField()) {
101100
field = ctx.lookUpField(rule.field)

0 commit comments

Comments
 (0)