diff --git a/base/build.gradle.kts b/base/build.gradle.kts index 25102bee35..6be73a1bd4 100644 --- a/base/build.gradle.kts +++ b/base/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -89,7 +89,6 @@ tasks { excludeGoogleProtoFromArtifacts() } - // For generating test fixtures. See `src/test/proto`. protobuf { configurations.excludeProtobufLite() @@ -99,6 +98,15 @@ protobuf { } generateProtoTasks.all().configureEach { + // The `doLast` action below deletes files from this task's own output + // directory, which is not reproduced when the task is restored from the + // Gradle build cache. A cached restoration yields an output (and a + // downstream descriptor set on the test classpath) that differs from a + // fresh run, intermittently leaving `io.spine.type.KnownTypes` with an + // incomplete set of types. Opt this task out of the build cache so it + // always executes and the deletion is always applied. + outputs.cacheIf { false } + // Delete files generated in `com.google` packages because // we add `protobuf(Protobuf.protoSrcLib)` dependency above. doLast { diff --git a/base/src/main/java/io/spine/query/QueryCriterion.java b/base/src/main/java/io/spine/query/QueryCriterion.java index 91307fd36e..120c70d12e 100644 --- a/base/src/main/java/io/spine/query/QueryCriterion.java +++ b/base/src/main/java/io/spine/query/QueryCriterion.java @@ -86,18 +86,44 @@ abstract class QueryCriterionThe shorter {@link #is(Object) is()} alias has the same effect and reads more + * fluently from Java. Prefer this method in Kotlin, where {@code is} is a reserved + * word and calling {@code is()} requires wrapping the name in backticks. * * @param value * the column value to use when querying * @return the instance of query builder associated with this criterion + * @see #is(Object) */ @CanIgnoreReturnValue - public B is(V value) { + public B isEqualTo(V value) { checkNotNull(value); return addParameter(builder, column, EQUALS, value); } + /** + * Appends an associated query builder with a criterion checking that the value + * of the associated column equals the one provided. + * + *

This method is a short form of {@link #isEqualTo(Object) isEqualTo()}. + * It is a convenience wrapper for working with a {@code QueryCriterion} from Java. + * + *

In Kotlin, prefer {@link #isEqualTo(Object) isEqualTo()} because {@code is} is + * a reserved word there, so calling this method requires wrapping its name in + * backticks. + * + * @param value + * the column value to use when querying + * @return the instance of query builder associated with this criterion + * @see #isEqualTo(Object) + */ + @CanIgnoreReturnValue + public B is(V value) { + return isEqualTo(value); + } + /** * Appends an associated query builder with a criterion checking that the value * of the associated column is less than the one provided. diff --git a/base/src/test/java/io/spine/query/RecordQueryBuilderTest.java b/base/src/test/java/io/spine/query/RecordQueryBuilderTest.java index 343821ec64..02d1f6dd80 100644 --- a/base/src/test/java/io/spine/query/RecordQueryBuilderTest.java +++ b/base/src/test/java/io/spine/query/RecordQueryBuilderTest.java @@ -1,11 +1,11 @@ /* - * Copyright 2022, TeamDev. All rights reserved. + * Copyright 2026, 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 * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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 @@ -254,6 +254,38 @@ void returnSameBuilder() { } } + @Nested + @DisplayName("support filtering by given values") + final class IsEqualTo { + + @Test + @DisplayName("appending an `EQUALS` parameter via `isEqualTo`") + void appendEqualsParameter() { + var isinValue = "JP 3496600002"; + var parameters = queryManufacturer() + .where(isin).isEqualTo(isinValue) + .predicate() + .parameters(); + assertThat(parameters).hasSize(1); + assertHasParamValue(parameters, isin, EQUALS, isinValue); + } + + @Test + @DisplayName("providing `is` alias for `isEqualTo`") + void matchIs() { + var isinValue = "JP 3496600002"; + var viaIs = queryManufacturer() + .where(isin).is(isinValue) + .predicate() + .parameters(); + var viaIsEqualTo = queryManufacturer() + .where(isin).isEqualTo(isinValue) + .predicate() + .parameters(); + assertThat(viaIsEqualTo).isEqualTo(viaIs); + } + } + @Nested @DisplayName("prevent") final class Prevent { diff --git a/docs/dependencies/dependencies.md b/docs/dependencies/dependencies.md index bc26d6d8ab..fd604e743e 100644 --- a/docs/dependencies/dependencies.md +++ b/docs/dependencies/dependencies.md @@ -1,6 +1,6 @@ -# Dependencies of `io.spine:spine-annotations:2.0.0-SNAPSHOT.420` +# Dependencies of `io.spine:spine-annotations:2.0.0-SNAPSHOT.421` ## Runtime 1. **Group** : org.jetbrains. **Name** : annotations. **Version** : 26.1.0. @@ -760,14 +760,14 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jun 18 20:57:17 WEST 2026** using +This report was generated on **Tue Jun 23 00:11:07 WEST 2026** 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:spine-base:2.0.0-SNAPSHOT.420` +# Dependencies of `io.spine:spine-base:2.0.0-SNAPSHOT.421` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -1604,14 +1604,14 @@ This report was generated on **Thu Jun 18 20:57:17 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jun 18 20:57:17 WEST 2026** using +This report was generated on **Tue Jun 23 00:11:07 WEST 2026** 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:spine-environment:2.0.0-SNAPSHOT.420` +# Dependencies of `io.spine:spine-environment:2.0.0-SNAPSHOT.421` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -2430,14 +2430,14 @@ This report was generated on **Thu Jun 18 20:57:17 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jun 18 20:57:17 WEST 2026** using +This report was generated on **Tue Jun 23 00:11:07 WEST 2026** 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:spine-format:2.0.0-SNAPSHOT.420` +# Dependencies of `io.spine:spine-format:2.0.0-SNAPSHOT.421` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.22.0. @@ -3336,6 +3336,6 @@ This report was generated on **Thu Jun 18 20:57:17 WEST 2026** using The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu Jun 18 20:57:17 WEST 2026** using +This report was generated on **Tue Jun 23 00:11:07 WEST 2026** 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/docs/dependencies/pom.xml b/docs/dependencies/pom.xml index 684cb71e6c..8179771bf9 100644 --- a/docs/dependencies/pom.xml +++ b/docs/dependencies/pom.xml @@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject. --> io.spine base-libraries -2.0.0-SNAPSHOT.420 +2.0.0-SNAPSHOT.421 2015 diff --git a/version.gradle.kts b/version.gradle.kts index 118dfb538f..3254c54509 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -24,4 +24,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -val versionToPublish: String by extra("2.0.0-SNAPSHOT.420") +val versionToPublish: String by extra("2.0.0-SNAPSHOT.421")