We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 20cc12c commit 2962eebCopy full SHA for 2962eeb
java/src/main/kotlin/io/spine/validation/java/DistinctFieldGenerator.kt
@@ -69,7 +69,7 @@ internal class DistinctFieldGenerator(private val view: DistinctField) {
69
val set = ImmutableSetClass.call<Set<*>>("copyOf", collection)
70
val constraint = CodeBlock(
71
"""
72
- if ($collection.size() != $set.size()) {
+ if (!$collection.isEmpty() && $collection.size() != $set.size()) {
73
var duplicates = ${extractDuplicates(collection)};
74
var fieldPath = ${fieldPath(parentPath)};
75
var violation = ${violation(ReadVar("fieldPath"), ReadVar("duplicates"))};
0 commit comments