Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import io.spine.dependency.local.CoreJvm
import io.spine.dependency.local.Logging
import io.spine.dependency.local.Time
import io.spine.dependency.local.ToolBase
import io.spine.dependency.local.Validation
import io.spine.gradle.publish.PublishingRepos
import io.spine.gradle.publish.spinePublishing
import io.spine.gradle.repo.standardToSpineSdk
Expand Down Expand Up @@ -130,6 +131,7 @@ allprojects {
Time.javaExtensions,
ToolBase.lib,
ToolBase.pluginBase,
Validation.javaBundle,
"io.spine.validation:spine-validation-java-runtime:2.0.0-SNAPSHOT.360",
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ package io.spine.dependency.lib
)
object Protobuf {
const val group = "com.google.protobuf"
const val version = "4.33.1"
const val version = "4.33.2"

/**
* The Java library with Protobuf data types.
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ package io.spine.dependency.local
*/
@Suppress("ConstPropertyName", "unused")
object Base {
const val version = "2.0.0-SNAPSHOT.383"
const val versionForBuildScript = "2.0.0-SNAPSHOT.383"
const val version = "2.0.0-SNAPSHOT.384"
const val versionForBuildScript = "2.0.0-SNAPSHOT.384"
const val group = Spine.group
private const val prefix = "spine"
const val libModule = "$prefix-base"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ package io.spine.dependency.local
*/
@Suppress("ConstPropertyName")
object BaseTypes {
const val version = "2.0.0-SNAPSHOT.212"
const val version = "2.0.0-SNAPSHOT.222"
const val group = Spine.group
const val artifact = "spine-base-types"
const val lib = "$group:$artifact:$version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ package io.spine.dependency.local
*/
@Suppress("ConstPropertyName")
object Change {
const val version = "2.0.0-SNAPSHOT.200"
const val version = "2.0.0-SNAPSHOT.205"
const val group = Spine.group
const val artifact = "spine-change"
const val lib = "$group:$artifact:$version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object Compiler : Dependency() {
* The version of the Compiler dependencies.
*/
override val version: String
private const val fallbackVersion = "2.0.0-SNAPSHOT.035"
private const val fallbackVersion = "2.0.0-SNAPSHOT.037"

/**
* The distinct version of the Compiler used by other build tools.
Expand All @@ -81,7 +81,7 @@ object Compiler : Dependency() {
* transitive dependencies, this is the version used to build the project itself.
*/
val dogfoodingVersion: String
private const val fallbackDfVersion = "2.0.0-SNAPSHOT.035"
private const val fallbackDfVersion = "2.0.0-SNAPSHOT.037"

/**
* The artifact for the Compiler Gradle plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ typealias CoreJava = CoreJvm
@Suppress("ConstPropertyName", "unused")
object CoreJvm {
const val group = Spine.group
const val version = "2.0.0-SNAPSHOT.358"
const val version = "2.0.0-SNAPSHOT.370"

const val coreArtifact = "spine-core"
const val clientArtifact = "spine-client"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ package io.spine.dependency.local
/**
* Dependencies on the CoreJvm Compiler artifacts.
*
* See [mc-java](https://github.com/SpineEventEngine/core-jvm-compiler).
* See [CoreJvm Compiler](https://github.com/SpineEventEngine/core-jvm-compiler).
*/
@Suppress(
"MemberVisibilityCanBePrivate" /* `pluginLib()` is used by subprojects. */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object Validation {
/**
* The version of the Validation library artifacts.
*/
const val version = "2.0.0-SNAPSHOT.378"
const val version = "2.0.0-SNAPSHOT.383"

/**
* The last version of Validation compatible with ProtoData.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import io.spine.tools.compiler.ast.OneofGroup
import io.spine.tools.compiler.ast.Span
import io.spine.tools.compiler.ast.qualifiedName
import io.spine.tools.compiler.check
import io.spine.validate.extractPlaceholders
import io.spine.validation.extractPlaceholders

/**
* Checks if this [String] contains placeholders that are not present in the given
Expand Down
256 changes: 128 additions & 128 deletions dependencies.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,7 @@ private fun MessagePsiClass.declareSupportingMethods(methods: List<MethodDeclara
* the provided [message] class name as its type parameter.
*/
private fun BuilderPsiClass.implementValidatingBuilder(message: PsiClass) {
// We use `ValidatingBuilder` at the old package to maintain backward compatibility
// for CoreJvm runtime. Once CoreJvm migrates to the new Validation Runtime, this
// line should be updated to use `io.spine.validation.ValidatingBuilder`.
@Suppress("DEPRECATION")
val qualifiedName = io.spine.validate.ValidatingBuilder::class.java.canonicalName
val qualifiedName = ValidatingBuilder::class.java.canonicalName
val genericParameter = message.qualifiedName!!
val reference = elementFactory.createInterfaceReference(qualifiedName, genericParameter)
implement(reference)
Comment on lines 191 to 195

Choose a reason for hiding this comment

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

P2 Badge Preserve deprecated ValidatingBuilder compatibility

The generator now makes builders implement only io.spine.validation.ValidatingBuilder. Because the deprecated io.spine.validate.ValidatingBuilder is a subtype of the new interface (not a supertype), code that still references the deprecated interface will no longer compile or pass instanceof checks after regenerating sources, even though the deprecated type still exists. If backward compatibility is still expected during the deprecation window, consider having generated builders implement the deprecated interface (or both) until it is removed.

Useful? React with 👍 / 👎.

Expand Down
34 changes: 17 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject.
-->
<groupId>io.spine.tools</groupId>
<artifactId>validation</artifactId>
<version>2.0.0-SNAPSHOT.383</version>
<version>2.0.0-SNAPSHOT.390</version>

<inceptionYear>2015</inceptionYear>

Expand All @@ -26,31 +26,31 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>4.33.1</version>
<version>4.33.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>4.33.1</version>
<version>4.33.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-kotlin</artifactId>
<version>4.33.1</version>
<version>4.33.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.spine</groupId>
<artifactId>spine-annotations</artifactId>
<version>2.0.0-SNAPSHOT.383</version>
<version>2.0.0-SNAPSHOT.384</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.spine</groupId>
<artifactId>spine-base</artifactId>
<version>2.0.0-SNAPSHOT.383</version>
<version>2.0.0-SNAPSHOT.384</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -68,31 +68,31 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine</groupId>
<artifactId>spine-validation-jvm-runtime</artifactId>
<version>2.0.0-SNAPSHOT.378</version>
<version>2.0.0-SNAPSHOT.383</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>compiler-backend</artifactId>
<version>2.0.0-SNAPSHOT.035</version>
<version>2.0.0-SNAPSHOT.037</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>compiler-gradle-api</artifactId>
<version>2.0.0-SNAPSHOT.035</version>
<version>2.0.0-SNAPSHOT.037</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>compiler-gradle-plugin</artifactId>
<version>2.0.0-SNAPSHOT.035</version>
<version>2.0.0-SNAPSHOT.037</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>compiler-jvm</artifactId>
<version>2.0.0-SNAPSHOT.035</version>
<version>2.0.0-SNAPSHOT.037</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -170,13 +170,13 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>compiler-api</artifactId>
<version>2.0.0-SNAPSHOT.035</version>
<version>2.0.0-SNAPSHOT.037</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>compiler-testlib</artifactId>
<version>2.0.0-SNAPSHOT.035</version>
<version>2.0.0-SNAPSHOT.037</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -256,7 +256,7 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId>
<version>4.33.1</version>
<version>4.33.2</version>
</dependency>
<dependency>
<groupId>dev.zacsweers.autoservice</groupId>
Expand All @@ -271,12 +271,12 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>compiler-cli-all</artifactId>
<version>2.0.0-SNAPSHOT.035</version>
<version>2.0.0-SNAPSHOT.037</version>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>compiler-protoc-plugin</artifactId>
<version>2.0.0-SNAPSHOT.035</version>
<version>2.0.0-SNAPSHOT.037</version>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
Expand All @@ -301,7 +301,7 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>validation-java-bundle</artifactId>
<version>2.0.0-SNAPSHOT.378</version>
<version>2.0.0-SNAPSHOT.383</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* 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.test;

import io.spine.test.protobuf.CardNumber;
import io.spine.type.TypeName;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertThrows;

@DisplayName("Generated Java code for a message when called from Java should")
class JavaMessageJavaApiSmokeTest {

/**
* The builder which should produce a valid instance.
*/
private final CardNumber.Builder valid =
CardNumber.newBuilder()
.setDigits("0000 0000 0000 0000");

@Test
@DisplayName("throw `NullPointerException` if given 'null' for the parent path")
@SuppressWarnings("DataFlowIssue" /* We pass `null` intentionally */)
void rejectNullParentPath() {
var message = valid.build();
assertThrows(NullPointerException.class, () ->
message.validate(null, TypeName.of("Something"))
);
}
}
32 changes: 32 additions & 0 deletions tests/validating/src/test/java/io/spine/test/package-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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.
*/

@CheckReturnValue
@NullMarked
package io.spine.test;

import com.google.errorprone.annotations.CheckReturnValue;
import org.jspecify.annotations.NullMarked;
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ import com.google.protobuf.Message
import io.kotest.matchers.collections.shouldContain
import io.kotest.matchers.collections.shouldNotBeEmpty
import io.kotest.matchers.shouldNotBe
import io.spine.base.FieldPath
import io.spine.test.protobuf.CardNumber
import io.spine.type.TypeName
import io.spine.validation.NonValidated
import io.spine.validation.ValidatableMessage
import io.spine.validation.Validate.check
Expand Down Expand Up @@ -74,16 +72,6 @@ internal class JavaMessageSmokeTest {
exception.constraintViolations.shouldNotBeEmpty()
}

@Test
fun `throw 'NullPointerException' if given 'null' for the parent path`() {
val message = valid.build()
assertThrows<NullPointerException> {
// The cast prevents the Kotlin compiler warning about passing `null`
// to a non-`@Nullable` Java parameter.
message.validate(null as FieldPath, TypeName.of("Something"))
}
}

@Test
fun `ignore invalid message when skipping validation intentionally via 'buildPartial'`() {
val number: @NonValidated Message = invalid.buildPartial()
Expand All @@ -100,7 +88,6 @@ internal class JavaMessageSmokeTest {

@Test
fun `make the message builder implement 'ValidatingBuilder'`() {
CardNumber.Builder::class.java.interfaces shouldContain
io.spine.validate.ValidatingBuilder::class.java
CardNumber.Builder::class.java.interfaces shouldContain ValidatingBuilder::class.java
}
}
2 changes: 1 addition & 1 deletion version.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
*
* For Spine-based dependencies please see [io.spine.dependency.local.Spine].
*/
val validationVersion by extra("2.0.0-SNAPSHOT.383")
val validationVersion by extra("2.0.0-SNAPSHOT.390")
Loading