diff --git a/src/main/java/org/mybatis/dynamic/sql/AbstractListValueCondition.java b/src/main/java/org/mybatis/dynamic/sql/AbstractListValueCondition.java index e178c6bf3..41c6a56e2 100644 --- a/src/main/java/org/mybatis/dynamic/sql/AbstractListValueCondition.java +++ b/src/main/java/org/mybatis/dynamic/sql/AbstractListValueCondition.java @@ -23,7 +23,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.render.RenderedParameterInfo; import org.mybatis.dynamic.sql.render.RenderingContext; import org.mybatis.dynamic.sql.util.FragmentAndParameters; @@ -114,7 +113,7 @@ public interface Filterable { * @return this condition if renderable and the value matches the predicate, otherwise a condition * that will not render. */ - AbstractListValueCondition filter(Predicate predicate); + AbstractListValueCondition filter(Predicate predicate); } /** @@ -139,6 +138,6 @@ public interface Mappable { * @return a new condition with the result of applying the mapper to the value of this condition, * if renderable, otherwise a condition that will not render. */ - AbstractListValueCondition map(Function mapper); + AbstractListValueCondition map(Function mapper); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/AbstractSingleValueCondition.java b/src/main/java/org/mybatis/dynamic/sql/AbstractSingleValueCondition.java index eb56eef39..c16dbf08c 100644 --- a/src/main/java/org/mybatis/dynamic/sql/AbstractSingleValueCondition.java +++ b/src/main/java/org/mybatis/dynamic/sql/AbstractSingleValueCondition.java @@ -21,7 +21,6 @@ import java.util.function.Predicate; import java.util.function.Supplier; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.render.RenderedParameterInfo; import org.mybatis.dynamic.sql.render.RenderingContext; import org.mybatis.dynamic.sql.util.FragmentAndParameters; @@ -89,7 +88,7 @@ public interface Filterable { * @return this condition if renderable and the value matches the predicate, otherwise a condition * that will not render. */ - AbstractSingleValueCondition filter(Predicate predicate); + AbstractSingleValueCondition filter(Predicate predicate); } /** @@ -114,6 +113,6 @@ public interface Mappable { * @return a new condition with the result of applying the mapper to the value of this condition, * if renderable, otherwise a condition that will not render. */ - AbstractSingleValueCondition map(Function mapper); + AbstractSingleValueCondition map(Function mapper); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/AbstractTwoValueCondition.java b/src/main/java/org/mybatis/dynamic/sql/AbstractTwoValueCondition.java index d409ffbb8..6cceff16e 100644 --- a/src/main/java/org/mybatis/dynamic/sql/AbstractTwoValueCondition.java +++ b/src/main/java/org/mybatis/dynamic/sql/AbstractTwoValueCondition.java @@ -23,7 +23,6 @@ import java.util.function.Predicate; import java.util.function.Supplier; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.render.RenderedParameterInfo; import org.mybatis.dynamic.sql.render.RenderingContext; import org.mybatis.dynamic.sql.util.FragmentAndParameters; @@ -111,7 +110,7 @@ public interface Filterable { * @return this condition if renderable and the values match the predicate, otherwise a condition * that will not render. */ - AbstractTwoValueCondition filter(BiPredicate predicate); + AbstractTwoValueCondition filter(BiPredicate predicate); /** * If renderable and both values match the predicate, returns this condition. Else returns a condition @@ -122,7 +121,7 @@ public interface Filterable { * @return this condition if renderable and the values match the predicate, otherwise a condition * that will not render. */ - AbstractTwoValueCondition filter(Predicate predicate); + AbstractTwoValueCondition filter(Predicate predicate); } /** @@ -148,8 +147,8 @@ public interface Mappable { * @return a new condition with the result of applying the mappers to the values of this condition, * if renderable, otherwise a condition that will not render. */ - AbstractTwoValueCondition map(Function mapper1, - Function mapper2); + AbstractTwoValueCondition map(Function mapper1, + Function mapper2); /** * If renderable, apply the mapping to both values and return a new condition with the new values. Else return a @@ -160,6 +159,6 @@ AbstractTwoValueCondition map(Function m * @return a new condition with the result of applying the mappers to the values of this condition, * if renderable, otherwise a condition that will not render. */ - AbstractTwoValueCondition map(Function mapper); + AbstractTwoValueCondition map(Function mapper); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/SqlBuilder.java b/src/main/java/org/mybatis/dynamic/sql/SqlBuilder.java index c8fe5c3ba..2a8243999 100644 --- a/src/main/java/org/mybatis/dynamic/sql/SqlBuilder.java +++ b/src/main/java/org/mybatis/dynamic/sql/SqlBuilder.java @@ -21,7 +21,6 @@ import java.util.Objects; import java.util.function.Supplier; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.delete.DeleteDSL; import org.mybatis.dynamic.sql.delete.DeleteModel; @@ -782,11 +781,11 @@ static IsLessThanOrEqualToWhenPresent isLessThanOrEqualToWhenPresent(Supp } @SafeVarargs - static IsIn isIn(@NonNull T... values) { + static IsIn isIn(T... values) { return IsIn.of(values); } - static IsIn isIn(Collection<@NonNull T> values) { + static IsIn isIn(Collection values) { return IsIn.of(values); } @@ -804,11 +803,11 @@ static IsInWhenPresent isInWhenPresent(@Nullable Collection<@Nullable T> } @SafeVarargs - static IsNotIn isNotIn(@NonNull T... values) { + static IsNotIn isNotIn(T... values) { return IsNotIn.of(values); } - static IsNotIn isNotIn(Collection<@NonNull T> values) { + static IsNotIn isNotIn(Collection values) { return IsNotIn.of(values); } @@ -829,7 +828,7 @@ static IsBetween.Builder isBetween(T value1) { return IsBetween.isBetween(value1); } - static IsBetween.Builder isBetween(Supplier<@NonNull T> valueSupplier1) { + static IsBetween.Builder isBetween(Supplier valueSupplier1) { return isBetween(valueSupplier1.get()); } @@ -845,7 +844,7 @@ static IsNotBetween.Builder isNotBetween(T value1) { return IsNotBetween.isNotBetween(value1); } - static IsNotBetween.Builder isNotBetween(Supplier<@NonNull T> valueSupplier1) { + static IsNotBetween.Builder isNotBetween(Supplier valueSupplier1) { return isNotBetween(valueSupplier1.get()); } diff --git a/src/main/java/org/mybatis/dynamic/sql/util/Utilities.java b/src/main/java/org/mybatis/dynamic/sql/util/Utilities.java index 0c3bd188f..b0c27081e 100644 --- a/src/main/java/org/mybatis/dynamic/sql/util/Utilities.java +++ b/src/main/java/org/mybatis/dynamic/sql/util/Utilities.java @@ -15,10 +15,19 @@ */ package org.mybatis.dynamic.sql.util; +import java.util.Collection; +import java.util.Objects; +import java.util.stream.Stream; + import org.jspecify.annotations.Nullable; public interface Utilities { static long safelyUnbox(@Nullable Long l) { return l == null ? 0 : l; } + + static Stream filterNulls(Collection<@Nullable T> values) { + // this method helps IntelliJ understand intended nullability + return values.stream().filter(Objects::nonNull); + } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/AndGatherer.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/AndGatherer.java index c9514f3fa..8a587262a 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/AndGatherer.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/AndGatherer.java @@ -17,8 +17,6 @@ import java.util.function.Supplier; -import org.jspecify.annotations.NonNull; - /** * Utility class supporting the "and" part of a between condition. This class supports builders, so it is mutable. * @@ -40,7 +38,7 @@ public R and(T value2) { return build(value2); } - public R and(Supplier<@NonNull T> valueSupplier2) { + public R and(Supplier valueSupplier2) { return and(valueSupplier2.get()); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsBetween.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsBetween.java index 0f7fcd66a..ffc801508 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsBetween.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsBetween.java @@ -20,10 +20,9 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractTwoValueCondition; -public class IsBetween extends AbstractTwoValueCondition<@NonNull T> +public class IsBetween extends AbstractTwoValueCondition implements AbstractTwoValueCondition.Filterable, AbstractTwoValueCondition.Mappable { private static final IsBetween EMPTY = new IsBetween(-1, -1) { @Override @@ -63,23 +62,23 @@ public String operator2() { } @Override - public IsBetween filter(BiPredicate predicate) { + public IsBetween filter(BiPredicate predicate) { return filterSupport(predicate, IsBetween::empty, this); } @Override - public IsBetween filter(Predicate predicate) { + public IsBetween filter(Predicate predicate) { return filterSupport(predicate, IsBetween::empty, this); } @Override - public IsBetween map(Function mapper1, - Function mapper2) { + public IsBetween map(Function mapper1, + Function mapper2) { return mapSupport(mapper1, mapper2, IsBetween::new, IsBetween::empty); } @Override - public IsBetween map(Function mapper) { + public IsBetween map(Function mapper) { return map(mapper, mapper); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsBetweenWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsBetweenWhenPresent.java index bc9c12d37..7b09bcb44 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsBetweenWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsBetweenWhenPresent.java @@ -20,7 +20,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractTwoValueCondition; @@ -64,23 +63,23 @@ public String operator2() { } @Override - public IsBetweenWhenPresent filter(BiPredicate predicate) { + public IsBetweenWhenPresent filter(BiPredicate predicate) { return filterSupport(predicate, IsBetweenWhenPresent::empty, this); } @Override - public IsBetweenWhenPresent filter(Predicate predicate) { + public IsBetweenWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsBetweenWhenPresent::empty, this); } @Override - public IsBetweenWhenPresent map(Function mapper1, - Function mapper2) { + public IsBetweenWhenPresent map(Function mapper1, + Function mapper2) { return mapSupport(mapper1, mapper2, IsBetweenWhenPresent::of, IsBetweenWhenPresent::empty); } @Override - public IsBetweenWhenPresent map(Function mapper) { + public IsBetweenWhenPresent map(Function mapper) { return map(mapper, mapper); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsEqualTo.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsEqualTo.java index db8548f61..51e6e4d47 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsEqualTo.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsEqualTo.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; public class IsEqualTo extends AbstractSingleValueCondition @@ -57,12 +56,12 @@ public static IsEqualTo of(T value) { } @Override - public IsEqualTo filter(Predicate predicate) { + public IsEqualTo filter(Predicate predicate) { return filterSupport(predicate, IsEqualTo::empty, this); } @Override - public IsEqualTo map(Function mapper) { + public IsEqualTo map(Function mapper) { return mapSupport(mapper, IsEqualTo::new, IsEqualTo::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsEqualToWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsEqualToWhenPresent.java index 2dd8c746d..f06489076 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsEqualToWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsEqualToWhenPresent.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; @@ -62,12 +61,12 @@ public static IsEqualToWhenPresent of(@Nullable T value) { } @Override - public IsEqualToWhenPresent filter(Predicate predicate) { + public IsEqualToWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsEqualToWhenPresent::empty, this); } @Override - public IsEqualToWhenPresent map(Function mapper) { + public IsEqualToWhenPresent map(Function mapper) { return mapSupport(mapper, IsEqualToWhenPresent::of, IsEqualToWhenPresent::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThan.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThan.java index 577a400f2..93be70911 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThan.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThan.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; public class IsGreaterThan extends AbstractSingleValueCondition @@ -56,12 +55,12 @@ public static IsGreaterThan of(T value) { } @Override - public IsGreaterThan filter(Predicate predicate) { + public IsGreaterThan filter(Predicate predicate) { return filterSupport(predicate, IsGreaterThan::empty, this); } @Override - public IsGreaterThan map(Function mapper) { + public IsGreaterThan map(Function mapper) { return mapSupport(mapper, IsGreaterThan::new, IsGreaterThan::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanOrEqualTo.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanOrEqualTo.java index 5fb4bd0d4..8373bf352 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanOrEqualTo.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanOrEqualTo.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; public class IsGreaterThanOrEqualTo extends AbstractSingleValueCondition @@ -56,12 +55,12 @@ public static IsGreaterThanOrEqualTo of(T value) { } @Override - public IsGreaterThanOrEqualTo filter(Predicate predicate) { + public IsGreaterThanOrEqualTo filter(Predicate predicate) { return filterSupport(predicate, IsGreaterThanOrEqualTo::empty, this); } @Override - public IsGreaterThanOrEqualTo map(Function mapper) { + public IsGreaterThanOrEqualTo map(Function mapper) { return mapSupport(mapper, IsGreaterThanOrEqualTo::new, IsGreaterThanOrEqualTo::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanOrEqualToWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanOrEqualToWhenPresent.java index 01f895dc9..ccb868c94 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanOrEqualToWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanOrEqualToWhenPresent.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; @@ -62,12 +61,12 @@ public static IsGreaterThanOrEqualToWhenPresent of(@Nullable T value) { } @Override - public IsGreaterThanOrEqualToWhenPresent filter(Predicate predicate) { + public IsGreaterThanOrEqualToWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsGreaterThanOrEqualToWhenPresent::empty, this); } @Override - public IsGreaterThanOrEqualToWhenPresent map(Function mapper) { + public IsGreaterThanOrEqualToWhenPresent map(Function mapper) { return mapSupport(mapper, IsGreaterThanOrEqualToWhenPresent::of, IsGreaterThanOrEqualToWhenPresent::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanWhenPresent.java index 779a15596..175b5fcf6 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsGreaterThanWhenPresent.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; @@ -61,12 +60,12 @@ public static IsGreaterThanWhenPresent of(@Nullable T value) { } @Override - public IsGreaterThanWhenPresent filter(Predicate predicate) { + public IsGreaterThanWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsGreaterThanWhenPresent::empty, this); } @Override - public IsGreaterThanWhenPresent map(Function mapper) { + public IsGreaterThanWhenPresent map(Function mapper) { return mapSupport(mapper, IsGreaterThanWhenPresent::of, IsGreaterThanWhenPresent::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsIn.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsIn.java index 67072dc8a..098db45f1 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsIn.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsIn.java @@ -21,7 +21,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractListValueCondition; import org.mybatis.dynamic.sql.render.RenderingContext; import org.mybatis.dynamic.sql.util.Validator; @@ -52,12 +51,12 @@ public String operator() { } @Override - public IsIn filter(Predicate predicate) { + public IsIn filter(Predicate predicate) { return filterSupport(predicate, IsIn::new, this, IsIn::empty); } @Override - public IsIn map(Function mapper) { + public IsIn map(Function mapper) { return mapSupport(mapper, IsIn::new, IsIn::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInCaseInsensitive.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInCaseInsensitive.java index d26a9c30f..3e2a22d2a 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInCaseInsensitive.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInCaseInsensitive.java @@ -21,7 +21,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractListValueCondition; import org.mybatis.dynamic.sql.render.RenderingContext; import org.mybatis.dynamic.sql.util.StringUtilities; @@ -54,12 +53,12 @@ public String operator() { } @Override - public IsInCaseInsensitive filter(Predicate predicate) { + public IsInCaseInsensitive filter(Predicate predicate) { return filterSupport(predicate, IsInCaseInsensitive::new, this, IsInCaseInsensitive::empty); } @Override - public IsInCaseInsensitive map(Function mapper) { + public IsInCaseInsensitive map(Function mapper) { return mapSupport(mapper, IsInCaseInsensitive::new, IsInCaseInsensitive::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInCaseInsensitiveWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInCaseInsensitiveWhenPresent.java index 6b4c1e1cd..3400a8337 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInCaseInsensitiveWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInCaseInsensitiveWhenPresent.java @@ -18,14 +18,13 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.Objects; import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractListValueCondition; import org.mybatis.dynamic.sql.util.StringUtilities; +import org.mybatis.dynamic.sql.util.Utilities; public class IsInCaseInsensitiveWhenPresent extends AbstractListValueCondition implements CaseInsensitiveRenderableCondition, AbstractListValueCondition.Filterable, @@ -40,7 +39,7 @@ public static IsInCaseInsensitiveWhenPresent empty() { } protected IsInCaseInsensitiveWhenPresent(Collection values) { - super(values.stream().filter(Objects::nonNull).map(StringUtilities::upperCaseIfPossible).toList()); + super(Utilities.filterNulls(values).map(StringUtilities::upperCaseIfPossible).toList()); } @Override @@ -49,13 +48,13 @@ public String operator() { } @Override - public IsInCaseInsensitiveWhenPresent filter(Predicate predicate) { + public IsInCaseInsensitiveWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsInCaseInsensitiveWhenPresent::new, this, IsInCaseInsensitiveWhenPresent::empty); } @Override - public IsInCaseInsensitiveWhenPresent map(Function mapper) { + public IsInCaseInsensitiveWhenPresent map(Function mapper) { return mapSupport(mapper, IsInCaseInsensitiveWhenPresent::new, IsInCaseInsensitiveWhenPresent::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInWhenPresent.java index abacd2690..246938da0 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsInWhenPresent.java @@ -18,13 +18,12 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.Objects; import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractListValueCondition; +import org.mybatis.dynamic.sql.util.Utilities; public class IsInWhenPresent extends AbstractListValueCondition implements AbstractListValueCondition.Filterable, AbstractListValueCondition.Mappable { @@ -36,8 +35,8 @@ public static IsInWhenPresent empty() { return t; } - protected IsInWhenPresent(Collection values) { - super(values.stream().filter(Objects::nonNull).toList()); + protected IsInWhenPresent(Collection<@Nullable T> values) { + super(Utilities.filterNulls(values).toList()); } @Override @@ -46,12 +45,12 @@ public String operator() { } @Override - public IsInWhenPresent filter(Predicate predicate) { + public IsInWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsInWhenPresent::new, this, IsInWhenPresent::empty); } @Override - public IsInWhenPresent map(Function mapper) { + public IsInWhenPresent map(Function mapper) { return mapSupport(mapper, IsInWhenPresent::of, IsInWhenPresent::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThan.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThan.java index ffe66bd97..3ed383fbd 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThan.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThan.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; public class IsLessThan extends AbstractSingleValueCondition @@ -57,12 +56,12 @@ public static IsLessThan of(T value) { } @Override - public IsLessThan filter(Predicate predicate) { + public IsLessThan filter(Predicate predicate) { return filterSupport(predicate, IsLessThan::empty, this); } @Override - public IsLessThan map(Function mapper) { + public IsLessThan map(Function mapper) { return mapSupport(mapper, IsLessThan::new, IsLessThan::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanOrEqualTo.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanOrEqualTo.java index a73707e3e..1b92e0c40 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanOrEqualTo.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanOrEqualTo.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; public class IsLessThanOrEqualTo extends AbstractSingleValueCondition @@ -56,12 +55,12 @@ public static IsLessThanOrEqualTo of(T value) { } @Override - public IsLessThanOrEqualTo filter(Predicate predicate) { + public IsLessThanOrEqualTo filter(Predicate predicate) { return filterSupport(predicate, IsLessThanOrEqualTo::empty, this); } @Override - public IsLessThanOrEqualTo map(Function mapper) { + public IsLessThanOrEqualTo map(Function mapper) { return mapSupport(mapper, IsLessThanOrEqualTo::new, IsLessThanOrEqualTo::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanOrEqualToWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanOrEqualToWhenPresent.java index d944b7a45..3cdc8ff39 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanOrEqualToWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanOrEqualToWhenPresent.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; @@ -61,12 +60,12 @@ public static IsLessThanOrEqualToWhenPresent of(@Nullable T value) { } @Override - public IsLessThanOrEqualToWhenPresent filter(Predicate predicate) { + public IsLessThanOrEqualToWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsLessThanOrEqualToWhenPresent::empty, this); } @Override - public IsLessThanOrEqualToWhenPresent map(Function mapper) { + public IsLessThanOrEqualToWhenPresent map(Function mapper) { return mapSupport(mapper, IsLessThanOrEqualToWhenPresent::of, IsLessThanOrEqualToWhenPresent::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanWhenPresent.java index 830bf788c..78a07f9a2 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLessThanWhenPresent.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; @@ -62,12 +61,12 @@ public static IsLessThanWhenPresent of(@Nullable T value) { } @Override - public IsLessThanWhenPresent filter(Predicate predicate) { + public IsLessThanWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsLessThanWhenPresent::empty, this); } @Override - public IsLessThanWhenPresent map(Function mapper) { + public IsLessThanWhenPresent map(Function mapper) { return mapSupport(mapper, IsLessThanWhenPresent::of, IsLessThanWhenPresent::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLike.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLike.java index f2d2a419a..e738bda4c 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLike.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLike.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; public class IsLike extends AbstractSingleValueCondition @@ -57,12 +56,12 @@ public static IsLike of(T value) { } @Override - public IsLike filter(Predicate predicate) { + public IsLike filter(Predicate predicate) { return filterSupport(predicate, IsLike::empty, this); } @Override - public IsLike map(Function mapper) { + public IsLike map(Function mapper) { return mapSupport(mapper, IsLike::new, IsLike::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeCaseInsensitive.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeCaseInsensitive.java index 43525e287..ffdc2bc7d 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeCaseInsensitive.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeCaseInsensitive.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; import org.mybatis.dynamic.sql.util.StringUtilities; @@ -54,12 +53,12 @@ public String operator() { } @Override - public IsLikeCaseInsensitive filter(Predicate predicate) { + public IsLikeCaseInsensitive filter(Predicate predicate) { return filterSupport(predicate, IsLikeCaseInsensitive::empty, this); } @Override - public IsLikeCaseInsensitive map(Function mapper) { + public IsLikeCaseInsensitive map(Function mapper) { return mapSupport(mapper, IsLikeCaseInsensitive::new, IsLikeCaseInsensitive::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeCaseInsensitiveWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeCaseInsensitiveWhenPresent.java index 60307625f..ae8398aef 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeCaseInsensitiveWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeCaseInsensitiveWhenPresent.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; import org.mybatis.dynamic.sql.util.StringUtilities; @@ -56,12 +55,12 @@ public String operator() { } @Override - public IsLikeCaseInsensitiveWhenPresent filter(Predicate predicate) { + public IsLikeCaseInsensitiveWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsLikeCaseInsensitiveWhenPresent::empty, this); } @Override - public IsLikeCaseInsensitiveWhenPresent map(Function mapper) { + public IsLikeCaseInsensitiveWhenPresent map(Function mapper) { return mapSupport(mapper, IsLikeCaseInsensitiveWhenPresent::of, IsLikeCaseInsensitiveWhenPresent::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeWhenPresent.java index fc20722a2..a69e55356 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsLikeWhenPresent.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; @@ -62,12 +61,12 @@ public static IsLikeWhenPresent of(@Nullable T value) { } @Override - public IsLikeWhenPresent filter(Predicate predicate) { + public IsLikeWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsLikeWhenPresent::empty, this); } @Override - public IsLikeWhenPresent map(Function mapper) { + public IsLikeWhenPresent map(Function mapper) { return mapSupport(mapper, IsLikeWhenPresent::of, IsLikeWhenPresent::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotBetween.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotBetween.java index b3d0d59ff..836e3c741 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotBetween.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotBetween.java @@ -20,7 +20,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractTwoValueCondition; public class IsNotBetween extends AbstractTwoValueCondition @@ -63,23 +62,23 @@ public String operator2() { } @Override - public IsNotBetween filter(BiPredicate predicate) { + public IsNotBetween filter(BiPredicate predicate) { return filterSupport(predicate, IsNotBetween::empty, this); } @Override - public IsNotBetween filter(Predicate predicate) { + public IsNotBetween filter(Predicate predicate) { return filterSupport(predicate, IsNotBetween::empty, this); } @Override - public IsNotBetween map(Function mapper1, - Function mapper2) { + public IsNotBetween map(Function mapper1, + Function mapper2) { return mapSupport(mapper1, mapper2, IsNotBetween::new, IsNotBetween::empty); } @Override - public IsNotBetween map(Function mapper) { + public IsNotBetween map(Function mapper) { return map(mapper, mapper); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotBetweenWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotBetweenWhenPresent.java index 3c9c8fc9f..020b651f2 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotBetweenWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotBetweenWhenPresent.java @@ -20,7 +20,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractTwoValueCondition; @@ -64,23 +63,23 @@ public String operator2() { } @Override - public IsNotBetweenWhenPresent filter(BiPredicate predicate) { + public IsNotBetweenWhenPresent filter(BiPredicate predicate) { return filterSupport(predicate, IsNotBetweenWhenPresent::empty, this); } @Override - public IsNotBetweenWhenPresent filter(Predicate predicate) { + public IsNotBetweenWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsNotBetweenWhenPresent::empty, this); } @Override - public IsNotBetweenWhenPresent map(Function mapper1, - Function mapper2) { + public IsNotBetweenWhenPresent map(Function mapper1, + Function mapper2) { return mapSupport(mapper1, mapper2, IsNotBetweenWhenPresent::of, IsNotBetweenWhenPresent::empty); } @Override - public IsNotBetweenWhenPresent map(Function mapper) { + public IsNotBetweenWhenPresent map(Function mapper) { return map(mapper, mapper); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotEqualTo.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotEqualTo.java index fc0292070..39070c2e8 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotEqualTo.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotEqualTo.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; public class IsNotEqualTo extends AbstractSingleValueCondition @@ -56,12 +55,12 @@ public static IsNotEqualTo of(T value) { } @Override - public IsNotEqualTo filter(Predicate predicate) { + public IsNotEqualTo filter(Predicate predicate) { return filterSupport(predicate, IsNotEqualTo::empty, this); } @Override - public IsNotEqualTo map(Function mapper) { + public IsNotEqualTo map(Function mapper) { return mapSupport(mapper, IsNotEqualTo::new, IsNotEqualTo::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotEqualToWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotEqualToWhenPresent.java index 1fff2d9ba..07ab3f6cf 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotEqualToWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotEqualToWhenPresent.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; @@ -61,12 +60,12 @@ public static IsNotEqualToWhenPresent of(@Nullable T value) { } @Override - public IsNotEqualToWhenPresent filter(Predicate predicate) { + public IsNotEqualToWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsNotEqualToWhenPresent::empty, this); } @Override - public IsNotEqualToWhenPresent map(Function mapper) { + public IsNotEqualToWhenPresent map(Function mapper) { return mapSupport(mapper, IsNotEqualToWhenPresent::of, IsNotEqualToWhenPresent::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotIn.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotIn.java index af6c248f4..e6b408fc8 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotIn.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotIn.java @@ -21,7 +21,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractListValueCondition; import org.mybatis.dynamic.sql.render.RenderingContext; import org.mybatis.dynamic.sql.util.Validator; @@ -52,12 +51,12 @@ public String operator() { } @Override - public IsNotIn filter(Predicate predicate) { + public IsNotIn filter(Predicate predicate) { return filterSupport(predicate, IsNotIn::new, this, IsNotIn::empty); } @Override - public IsNotIn map(Function mapper) { + public IsNotIn map(Function mapper) { return mapSupport(mapper, IsNotIn::new, IsNotIn::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInCaseInsensitive.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInCaseInsensitive.java index 98a9ca9db..2bc802ab8 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInCaseInsensitive.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInCaseInsensitive.java @@ -21,7 +21,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractListValueCondition; import org.mybatis.dynamic.sql.render.RenderingContext; import org.mybatis.dynamic.sql.util.StringUtilities; @@ -54,12 +53,12 @@ public String operator() { } @Override - public IsNotInCaseInsensitive filter(Predicate predicate) { + public IsNotInCaseInsensitive filter(Predicate predicate) { return filterSupport(predicate, IsNotInCaseInsensitive::new, this, IsNotInCaseInsensitive::empty); } @Override - public IsNotInCaseInsensitive map(Function mapper) { + public IsNotInCaseInsensitive map(Function mapper) { return mapSupport(mapper, IsNotInCaseInsensitive::new, IsNotInCaseInsensitive::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInCaseInsensitiveWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInCaseInsensitiveWhenPresent.java index 6852c67fd..2640e062f 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInCaseInsensitiveWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInCaseInsensitiveWhenPresent.java @@ -18,14 +18,13 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.Objects; import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractListValueCondition; import org.mybatis.dynamic.sql.util.StringUtilities; +import org.mybatis.dynamic.sql.util.Utilities; public class IsNotInCaseInsensitiveWhenPresent extends AbstractListValueCondition implements CaseInsensitiveRenderableCondition, AbstractListValueCondition.Filterable, @@ -40,7 +39,7 @@ public static IsNotInCaseInsensitiveWhenPresent empty() { } protected IsNotInCaseInsensitiveWhenPresent(Collection values) { - super(values.stream().filter(Objects::nonNull).map(StringUtilities::upperCaseIfPossible).toList()); + super(Utilities.filterNulls(values).map(StringUtilities::upperCaseIfPossible).toList()); } @Override @@ -49,13 +48,13 @@ public String operator() { } @Override - public IsNotInCaseInsensitiveWhenPresent filter(Predicate predicate) { + public IsNotInCaseInsensitiveWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsNotInCaseInsensitiveWhenPresent::new, this, IsNotInCaseInsensitiveWhenPresent::empty); } @Override - public IsNotInCaseInsensitiveWhenPresent map(Function mapper) { + public IsNotInCaseInsensitiveWhenPresent map(Function mapper) { return mapSupport(mapper, IsNotInCaseInsensitiveWhenPresent::new, IsNotInCaseInsensitiveWhenPresent::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInWhenPresent.java index 33efb1782..6624a50ad 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotInWhenPresent.java @@ -18,13 +18,12 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.Objects; import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractListValueCondition; +import org.mybatis.dynamic.sql.util.Utilities; public class IsNotInWhenPresent extends AbstractListValueCondition implements AbstractListValueCondition.Filterable, AbstractListValueCondition.Mappable { @@ -36,8 +35,8 @@ public static IsNotInWhenPresent empty() { return t; } - protected IsNotInWhenPresent(Collection values) { - super(values.stream().filter(Objects::nonNull).toList()); + protected IsNotInWhenPresent(Collection<@Nullable T> values) { + super(Utilities.filterNulls(values).toList()); } @Override @@ -46,12 +45,12 @@ public String operator() { } @Override - public IsNotInWhenPresent filter(Predicate predicate) { + public IsNotInWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsNotInWhenPresent::new, this, IsNotInWhenPresent::empty); } @Override - public IsNotInWhenPresent map(Function mapper) { + public IsNotInWhenPresent map(Function mapper) { return mapSupport(mapper, IsNotInWhenPresent::new, IsNotInWhenPresent::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLike.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLike.java index b5b82d675..a62dc3e9e 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLike.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLike.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; public class IsNotLike extends AbstractSingleValueCondition @@ -56,12 +55,12 @@ public static IsNotLike of(T value) { } @Override - public IsNotLike filter(Predicate predicate) { + public IsNotLike filter(Predicate predicate) { return filterSupport(predicate, IsNotLike::empty, this); } @Override - public IsNotLike map(Function mapper) { + public IsNotLike map(Function mapper) { return mapSupport(mapper, IsNotLike::new, IsNotLike::empty); } } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeCaseInsensitive.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeCaseInsensitive.java index 1604deb3b..6bd943227 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeCaseInsensitive.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeCaseInsensitive.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; import org.mybatis.dynamic.sql.util.StringUtilities; @@ -54,12 +53,12 @@ public String operator() { } @Override - public IsNotLikeCaseInsensitive filter(Predicate predicate) { + public IsNotLikeCaseInsensitive filter(Predicate predicate) { return filterSupport(predicate, IsNotLikeCaseInsensitive::empty, this); } @Override - public IsNotLikeCaseInsensitive map(Function mapper) { + public IsNotLikeCaseInsensitive map(Function mapper) { return mapSupport(mapper, IsNotLikeCaseInsensitive::new, IsNotLikeCaseInsensitive::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeCaseInsensitiveWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeCaseInsensitiveWhenPresent.java index cc0b04549..df07202f9 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeCaseInsensitiveWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeCaseInsensitiveWhenPresent.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; import org.mybatis.dynamic.sql.util.StringUtilities; @@ -56,12 +55,12 @@ public String operator() { } @Override - public IsNotLikeCaseInsensitiveWhenPresent filter(Predicate predicate) { + public IsNotLikeCaseInsensitiveWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsNotLikeCaseInsensitiveWhenPresent::empty, this); } @Override - public IsNotLikeCaseInsensitiveWhenPresent map(Function mapper) { + public IsNotLikeCaseInsensitiveWhenPresent map(Function mapper) { return mapSupport(mapper, IsNotLikeCaseInsensitiveWhenPresent::of, IsNotLikeCaseInsensitiveWhenPresent::empty); } diff --git a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeWhenPresent.java b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeWhenPresent.java index a3571b0ee..d018c9062 100644 --- a/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeWhenPresent.java +++ b/src/main/java/org/mybatis/dynamic/sql/where/condition/IsNotLikeWhenPresent.java @@ -19,7 +19,6 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; import org.mybatis.dynamic.sql.AbstractSingleValueCondition; @@ -61,12 +60,12 @@ public static IsNotLikeWhenPresent of(@Nullable T value) { } @Override - public IsNotLikeWhenPresent filter(Predicate predicate) { + public IsNotLikeWhenPresent filter(Predicate predicate) { return filterSupport(predicate, IsNotLikeWhenPresent::empty, this); } @Override - public IsNotLikeWhenPresent map(Function mapper) { + public IsNotLikeWhenPresent map(Function mapper) { return mapSupport(mapper, IsNotLikeWhenPresent::of, IsNotLikeWhenPresent::empty); } } diff --git a/src/test/java/config/TestContainersConfiguration.java b/src/test/java/config/TestContainersConfiguration.java index 77fd866b0..0b39fbb85 100644 --- a/src/test/java/config/TestContainersConfiguration.java +++ b/src/test/java/config/TestContainersConfiguration.java @@ -21,7 +21,8 @@ * Utility interface to hold Docker image tags for the test containers we use */ public interface TestContainersConfiguration { - DockerImageName POSTGRES_LATEST = DockerImageName.parse("postgres:17.2"); - DockerImageName MARIADB_LATEST = DockerImageName.parse("mariadb:11.6.2"); - DockerImageName MYSQL_LATEST = DockerImageName.parse("mysql:9.1.0"); + DockerImageName POSTGRES_LATEST = DockerImageName.parse("postgres:18.0"); + DockerImageName MARIADB_LATEST = DockerImageName.parse("mariadb:12.0.2"); + // Note - Can't go past MySQL:9.2.0 until this is released: https://github.com/testcontainers/testcontainers-java/pull/10185 + DockerImageName MYSQL_LATEST = DockerImageName.parse("mysql:9.2.0"); } diff --git a/src/test/java/examples/array/NamesRecord.java b/src/test/java/examples/array/NamesRecord.java index 65765ccfe..3a90985d2 100644 --- a/src/test/java/examples/array/NamesRecord.java +++ b/src/test/java/examples/array/NamesRecord.java @@ -15,11 +15,13 @@ */ package examples.array; +import org.jspecify.annotations.Nullable; + public class NamesRecord { - private Integer id; - private String[] names; + private @Nullable Integer id; + private @Nullable String[] names; - public Integer getId() { + public @Nullable Integer getId() { return id; } @@ -27,7 +29,7 @@ public void setId(Integer id) { this.id = id; } - public String[] getNames() { + public @Nullable String[] getNames() { return names; } diff --git a/src/test/java/examples/array/NamesTableDynamicSqlSupport.java b/src/test/java/examples/array/NamesTableDynamicSqlSupport.java index ce3cfbb8f..eb7c0625b 100644 --- a/src/test/java/examples/array/NamesTableDynamicSqlSupport.java +++ b/src/test/java/examples/array/NamesTableDynamicSqlSupport.java @@ -17,13 +17,14 @@ import java.sql.JDBCType; +import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.SqlColumn; import org.mybatis.dynamic.sql.SqlTable; public class NamesTableDynamicSqlSupport { public static final NamesTable namesTable = new NamesTable(); public static final SqlColumn id = namesTable.id; - public static final SqlColumn names = namesTable.names; + public static final SqlColumn names = namesTable.names; public static final class NamesTable extends SqlTable { public NamesTable() { @@ -31,7 +32,7 @@ public NamesTable() { } public final SqlColumn id = column("id", JDBCType.INTEGER); - public final SqlColumn names = column("names", JDBCType.ARRAY, + public final SqlColumn names = column("names", JDBCType.ARRAY, "examples.array.StringArrayTypeHandler"); } } diff --git a/src/test/java/examples/array/package-info.java b/src/test/java/examples/array/package-info.java new file mode 100644 index 000000000..3b3e3a5a3 --- /dev/null +++ b/src/test/java/examples/array/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package examples.array; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/examples/column/comparison/ColumnComparisonConfiguration.java b/src/test/java/examples/column/comparison/ColumnComparisonConfiguration.java index 12bb66cf3..6f364dc10 100644 --- a/src/test/java/examples/column/comparison/ColumnComparisonConfiguration.java +++ b/src/test/java/examples/column/comparison/ColumnComparisonConfiguration.java @@ -25,6 +25,8 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import java.util.Objects; + @Configuration @MapperScan("examples.column.comparison") public class ColumnComparisonConfiguration { @@ -41,6 +43,6 @@ public DataSource datasource() { public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean(); factoryBean.setDataSource(dataSource); - return factoryBean.getObject(); + return Objects.requireNonNull(factoryBean.getObject()); } } diff --git a/src/test/java/examples/column/comparison/package-info.java b/src/test/java/examples/column/comparison/package-info.java new file mode 100644 index 000000000..2ec154bb0 --- /dev/null +++ b/src/test/java/examples/column/comparison/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package examples.column.comparison; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/examples/complexquery/package-info.java b/src/test/java/examples/complexquery/package-info.java new file mode 100644 index 000000000..d10955a0a --- /dev/null +++ b/src/test/java/examples/complexquery/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package examples.complexquery; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/examples/generated/always/mybatis/GeneratedKey.java b/src/test/java/examples/generated/always/mybatis/GeneratedKey.java index 8a65ac7ec..7509202c5 100644 --- a/src/test/java/examples/generated/always/mybatis/GeneratedKey.java +++ b/src/test/java/examples/generated/always/mybatis/GeneratedKey.java @@ -15,11 +15,13 @@ */ package examples.generated.always.mybatis; +import org.jspecify.annotations.Nullable; + public class GeneratedKey { - private Integer key; + private @Nullable Integer key; - public Integer getKey() { + public @Nullable Integer getKey() { return key; } diff --git a/src/test/java/examples/generated/always/mybatis/package-info.java b/src/test/java/examples/generated/always/mybatis/package-info.java new file mode 100644 index 000000000..86d24bc7c --- /dev/null +++ b/src/test/java/examples/generated/always/mybatis/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package examples.generated.always.mybatis; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/examples/generated/always/spring/package-info.java b/src/test/java/examples/generated/always/spring/package-info.java new file mode 100644 index 000000000..10d19611c --- /dev/null +++ b/src/test/java/examples/generated/always/spring/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package examples.generated.always.spring; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/examples/groupby/package-info.java b/src/test/java/examples/groupby/package-info.java new file mode 100644 index 000000000..589e995e4 --- /dev/null +++ b/src/test/java/examples/groupby/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package examples.groupby; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/examples/joins/OrderMaster.java b/src/test/java/examples/joins/OrderMaster.java index 9972b6db9..2d75b4b59 100644 --- a/src/test/java/examples/joins/OrderMaster.java +++ b/src/test/java/examples/joins/OrderMaster.java @@ -18,12 +18,14 @@ import java.util.Date; import java.util.List; +import org.jspecify.annotations.Nullable; + public class OrderMaster { - private Integer id; - private Date orderDate; - private List details; + private @Nullable Integer id; + private @Nullable Date orderDate; + private @Nullable List details; - public Integer getId() { + public @Nullable Integer getId() { return id; } @@ -31,7 +33,7 @@ public void setId(Integer id) { this.id = id; } - public Date getOrderDate() { + public @Nullable Date getOrderDate() { return orderDate; } @@ -39,7 +41,7 @@ public void setOrderDate(Date orderDate) { this.orderDate = orderDate; } - public List getDetails() { + public @Nullable List getDetails() { return details; } diff --git a/src/test/java/examples/mariadb/package-info.java b/src/test/java/examples/mariadb/package-info.java new file mode 100644 index 000000000..1f939000b --- /dev/null +++ b/src/test/java/examples/mariadb/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package examples.mariadb; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/examples/postgres/package-info.java b/src/test/java/examples/postgres/package-info.java new file mode 100644 index 000000000..ed5684db7 --- /dev/null +++ b/src/test/java/examples/postgres/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package examples.postgres; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/examples/simple/AddressRecord.java b/src/test/java/examples/simple/AddressRecord.java index 5af471126..6e72df889 100644 --- a/src/test/java/examples/simple/AddressRecord.java +++ b/src/test/java/examples/simple/AddressRecord.java @@ -15,14 +15,16 @@ */ package examples.simple; +import org.jspecify.annotations.Nullable; + public class AddressRecord { - private Integer id; - private String streetAddress; - private String city; - private String state; - private AddressType addressType; + private @Nullable Integer id; + private @Nullable String streetAddress; + private @Nullable String city; + private @Nullable String state; + private @Nullable AddressType addressType; - public Integer getId() { + public @Nullable Integer getId() { return id; } @@ -30,7 +32,7 @@ public void setId(Integer id) { this.id = id; } - public String getStreetAddress() { + public @Nullable String getStreetAddress() { return streetAddress; } @@ -38,7 +40,7 @@ public void setStreetAddress(String streetAddress) { this.streetAddress = streetAddress; } - public String getCity() { + public @Nullable String getCity() { return city; } @@ -46,7 +48,7 @@ public void setCity(String city) { this.city = city; } - public String getState() { + public @Nullable String getState() { return state; } @@ -54,7 +56,7 @@ public void setState(String state) { this.state = state; } - public AddressType getAddressType() { + public @Nullable AddressType getAddressType() { return addressType; } diff --git a/src/test/java/examples/simple/PersonMapperTest.java b/src/test/java/examples/simple/PersonMapperTest.java index b50e38183..4843431f4 100644 --- a/src/test/java/examples/simple/PersonMapperTest.java +++ b/src/test/java/examples/simple/PersonMapperTest.java @@ -626,13 +626,13 @@ void testJoinAllRows() { assertThat(records.get(0).getLastName()).isEqualTo(new LastName("Flintstone")); assertThat(records.get(0).getOccupation()).isEqualTo("Brontosaurus Operator"); assertThat(records.get(0).getBirthDate()).isNotNull(); - assertThat(records.get(0).getAddress().getId()).isEqualTo(1); - assertThat(records.get(0).getAddress().getStreetAddress()).isEqualTo("123 Main Street"); - assertThat(records.get(0).getAddress().getCity()).isEqualTo("Bedrock"); - assertThat(records.get(0).getAddress().getState()).isEqualTo("IN"); - assertThat(records.get(0).getAddress().getAddressType()).isEqualTo(AddressRecord.AddressType.HOME); + assertThat(records.get(0).getAddress()).isNotNull() + .extracting("id", "streetAddress", "city", "state", "addressType") + .containsExactly(1, "123 Main Street", "Bedrock", "IN", AddressRecord.AddressType.HOME); - assertThat(records.get(4).getAddress().getAddressType()).isEqualTo(AddressRecord.AddressType.BUSINESS); + assertThat(records.get(4).getAddress()).isNotNull() + .extracting("addressType") + .isEqualTo(AddressRecord.AddressType.BUSINESS); } } @@ -649,10 +649,9 @@ void testJoinOneRow() { assertThat(records.get(0).getLastName()).isEqualTo(new LastName("Flintstone")); assertThat(records.get(0).getOccupation()).isEqualTo("Brontosaurus Operator"); assertThat(records.get(0).getBirthDate()).isNotNull(); - assertThat(records.get(0).getAddress().getId()).isEqualTo(1); - assertThat(records.get(0).getAddress().getStreetAddress()).isEqualTo("123 Main Street"); - assertThat(records.get(0).getAddress().getCity()).isEqualTo("Bedrock"); - assertThat(records.get(0).getAddress().getState()).isEqualTo("IN"); + assertThat(records.get(0).getAddress()).isNotNull() + .extracting("id", "streetAddress", "city", "state", "addressType") + .containsExactly(1, "123 Main Street", "Bedrock", "IN", AddressRecord.AddressType.HOME); } } @@ -669,10 +668,9 @@ void testJoinPrimaryKey() { assertThat(r.getLastName()).isEqualTo(new LastName("Flintstone")); assertThat(r.getOccupation()).isEqualTo("Brontosaurus Operator"); assertThat(r.getBirthDate()).isNotNull(); - assertThat(r.getAddress().getId()).isEqualTo(1); - assertThat(r.getAddress().getStreetAddress()).isEqualTo("123 Main Street"); - assertThat(r.getAddress().getCity()).isEqualTo("Bedrock"); - assertThat(r.getAddress().getState()).isEqualTo("IN"); + assertThat(r.getAddress()).isNotNull() + .extracting("id", "streetAddress", "city", "state", "addressType") + .containsExactly(1, "123 Main Street", "Bedrock", "IN", AddressRecord.AddressType.HOME); }); } } diff --git a/src/test/java/examples/simple/PersonWithAddress.java b/src/test/java/examples/simple/PersonWithAddress.java index ec38997e5..49ef7e429 100644 --- a/src/test/java/examples/simple/PersonWithAddress.java +++ b/src/test/java/examples/simple/PersonWithAddress.java @@ -15,18 +15,20 @@ */ package examples.simple; +import org.jspecify.annotations.Nullable; + import java.util.Date; public class PersonWithAddress { - private Integer id; - private String firstName; - private LastName lastName; - private Date birthDate; - private Boolean employed; - private String occupation; - private AddressRecord address; - - public Integer getId() { + private @Nullable Integer id; + private @Nullable String firstName; + private @Nullable LastName lastName; + private @Nullable Date birthDate; + private @Nullable Boolean employed; + private @Nullable String occupation; + private @Nullable AddressRecord address; + + public @Nullable Integer getId() { return id; } @@ -34,7 +36,7 @@ public void setId(Integer id) { this.id = id; } - public String getFirstName() { + public @Nullable String getFirstName() { return firstName; } @@ -42,7 +44,7 @@ public void setFirstName(String firstName) { this.firstName = firstName; } - public LastName getLastName() { + public @Nullable LastName getLastName() { return lastName; } @@ -50,7 +52,7 @@ public void setLastName(LastName lastName) { this.lastName = lastName; } - public Date getBirthDate() { + public @Nullable Date getBirthDate() { return birthDate; } @@ -58,7 +60,7 @@ public void setBirthDate(Date birthDate) { this.birthDate = birthDate; } - public String getOccupation() { + public @Nullable String getOccupation() { return occupation; } @@ -66,7 +68,7 @@ public void setOccupation(String occupation) { this.occupation = occupation; } - public Boolean getEmployed() { + public @Nullable Boolean getEmployed() { return employed; } @@ -74,7 +76,7 @@ public void setEmployed(Boolean employed) { this.employed = employed; } - public AddressRecord getAddress() { + public @Nullable AddressRecord getAddress() { return address; } diff --git a/src/test/java/examples/springbatch/mapper/package-info.java b/src/test/java/examples/springbatch/mapper/package-info.java new file mode 100644 index 000000000..3c776ca26 --- /dev/null +++ b/src/test/java/examples/springbatch/mapper/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package examples.springbatch.mapper; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/examples/type_conversion/MyFilesDynamicSqlSupport.java b/src/test/java/examples/type_conversion/MyFilesDynamicSqlSupport.java index 7a58cab44..6bed1ce53 100644 --- a/src/test/java/examples/type_conversion/MyFilesDynamicSqlSupport.java +++ b/src/test/java/examples/type_conversion/MyFilesDynamicSqlSupport.java @@ -17,17 +17,18 @@ import java.sql.JDBCType; +import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.SqlColumn; import org.mybatis.dynamic.sql.SqlTable; public final class MyFilesDynamicSqlSupport { public static final MyFiles myfiles = new MyFiles(); public static final SqlColumn fileId = myfiles.fileId; - public static final SqlColumn fileContents = myfiles.fileContents; + public static final SqlColumn fileContents = myfiles.fileContents; public static final class MyFiles extends SqlTable { public final SqlColumn fileId = column("file_id", JDBCType.INTEGER); - public final SqlColumn fileContents = column("file_contents", JDBCType.LONGVARBINARY); + public final SqlColumn fileContents = column("file_contents", JDBCType.LONGVARBINARY); public MyFiles() { super("MyFiles"); diff --git a/src/test/java/examples/type_conversion/ToBase64.java b/src/test/java/examples/type_conversion/ToBase64.java index 46cdb26ed..56437bfcb 100644 --- a/src/test/java/examples/type_conversion/ToBase64.java +++ b/src/test/java/examples/type_conversion/ToBase64.java @@ -18,13 +18,14 @@ import java.sql.JDBCType; import java.util.Optional; +import org.jspecify.annotations.NonNull; import org.mybatis.dynamic.sql.BasicColumn; import org.mybatis.dynamic.sql.BindableColumn; import org.mybatis.dynamic.sql.render.RenderingContext; import org.mybatis.dynamic.sql.select.function.AbstractTypeConvertingFunction; import org.mybatis.dynamic.sql.util.FragmentAndParameters; -public class ToBase64 extends AbstractTypeConvertingFunction { +public class ToBase64 extends AbstractTypeConvertingFunction { protected ToBase64(BasicColumn column) { super(column); @@ -46,7 +47,7 @@ protected ToBase64 copy() { return new ToBase64(column); } - public static ToBase64 toBase64(BindableColumn column) { + public static ToBase64 toBase64(BindableColumn column) { return new ToBase64(column); } } diff --git a/src/test/java/issues/gh100/package-info.java b/src/test/java/issues/gh100/package-info.java new file mode 100644 index 000000000..52ab28b7f --- /dev/null +++ b/src/test/java/issues/gh100/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package issues.gh100; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/issues/gh105/package-info.java b/src/test/java/issues/gh105/package-info.java new file mode 100644 index 000000000..a204f10fe --- /dev/null +++ b/src/test/java/issues/gh105/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package issues.gh105; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/issues/gh324/NameRecord.java b/src/test/java/issues/gh324/NameRecord.java index a00286095..9b02e327d 100644 --- a/src/test/java/issues/gh324/NameRecord.java +++ b/src/test/java/issues/gh324/NameRecord.java @@ -17,23 +17,5 @@ import java.io.Serializable; -public class NameRecord implements Serializable { - private Integer id; - private String name; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } +public record NameRecord (Integer id, String name) implements Serializable { } diff --git a/src/test/java/issues/gh324/NameService.java b/src/test/java/issues/gh324/NameService.java index d7de92076..a303632bc 100644 --- a/src/test/java/issues/gh324/NameService.java +++ b/src/test/java/issues/gh324/NameService.java @@ -60,9 +60,7 @@ public NameService() { public void insertRecord() { try (SqlSession session = sqlSessionFactory.openSession(true)) { NameTableMapper mapper = session.getMapper(NameTableMapper.class); - NameRecord row = new NameRecord(); - row.setId(1); - row.setName("Fred"); + NameRecord row = new NameRecord(1, "Fred"); mapper.insert(row); } } @@ -70,9 +68,7 @@ public void insertRecord() { public void updateRecordWithAutoCommit() { try (SqlSession session = sqlSessionFactory.openSession(true)) { NameTableMapper mapper = session.getMapper(NameTableMapper.class); - NameRecord row = new NameRecord(); - row.setId(1); - row.setName("Barney"); + NameRecord row = new NameRecord(1, "Barney"); mapper.updateByPrimaryKey(row); } } @@ -81,9 +77,7 @@ public void updateRecordWithoutAutoCommitAndNoExplicitCommit() { // this should rollback try (SqlSession session = sqlSessionFactory.openSession()) { NameTableMapper mapper = session.getMapper(NameTableMapper.class); - NameRecord row = new NameRecord(); - row.setId(1); - row.setName("Barney"); + NameRecord row = new NameRecord(1, "Barney"); mapper.updateByPrimaryKey(row); } } @@ -91,9 +85,7 @@ public void updateRecordWithoutAutoCommitAndNoExplicitCommit() { public void updateRecordWithoutAutoCommitAndExplicitCommit() { try (SqlSession session = sqlSessionFactory.openSession()) { NameTableMapper mapper = session.getMapper(NameTableMapper.class); - NameRecord row = new NameRecord(); - row.setId(1); - row.setName("Barney"); + NameRecord row = new NameRecord(1, "Barney"); mapper.updateByPrimaryKey(row); session.commit(); } diff --git a/src/test/java/issues/gh324/NameTableMapper.java b/src/test/java/issues/gh324/NameTableMapper.java index 76723ac73..0bb2ced6c 100644 --- a/src/test/java/issues/gh324/NameTableMapper.java +++ b/src/test/java/issues/gh324/NameTableMapper.java @@ -21,26 +21,31 @@ import java.util.List; import java.util.Optional; -import org.apache.ibatis.annotations.*; +import org.apache.ibatis.annotations.Arg; +import org.apache.ibatis.annotations.CacheNamespace; +import org.apache.ibatis.annotations.SelectProvider; import org.mybatis.dynamic.sql.BasicColumn; import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter; import org.mybatis.dynamic.sql.select.SelectDSLCompleter; import org.mybatis.dynamic.sql.select.render.SelectStatementProvider; import org.mybatis.dynamic.sql.update.UpdateDSLCompleter; import org.mybatis.dynamic.sql.util.SqlProviderAdapter; -import org.mybatis.dynamic.sql.util.mybatis3.*; +import org.mybatis.dynamic.sql.util.mybatis3.CommonCountMapper; +import org.mybatis.dynamic.sql.util.mybatis3.CommonDeleteMapper; +import org.mybatis.dynamic.sql.util.mybatis3.CommonInsertMapper; +import org.mybatis.dynamic.sql.util.mybatis3.CommonUpdateMapper; +import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils; @CacheNamespace(implementation = ObservableCache.class) public interface NameTableMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper, CommonUpdateMapper { @SelectProvider(type=SqlProviderAdapter.class, method="select") - @Results(id="NameTableResult", value={ - @Result(column="id", property="id", id=true), - @Result(column="name", property="name") - }) + @Arg(column = "id", javaType = Integer.class, id = true) + @Arg(column = "name", javaType = String.class) List selectMany(SelectStatementProvider selectStatement); @SelectProvider(type=SqlProviderAdapter.class, method="select") - @ResultMap("NameTableResult") + @Arg(column = "id", javaType = Integer.class, id = true) + @Arg(column = "name", javaType = String.class) Optional selectOne(SelectStatementProvider selectStatement); BasicColumn[] selectList = BasicColumn.columnList(id, name); @@ -68,8 +73,8 @@ default int update(UpdateDSLCompleter completer) { default int updateByPrimaryKey(NameRecord row) { return update(c -> - c.set(name).equalTo(row::getName) - .where(id, isEqualTo(row::getId)) + c.set(name).equalTo(row::name) + .where(id, isEqualTo(row::id)) ); } diff --git a/src/test/java/issues/gh324/ObservableCache.java b/src/test/java/issues/gh324/ObservableCache.java index d52a2bcd0..ebc074e9b 100644 --- a/src/test/java/issues/gh324/ObservableCache.java +++ b/src/test/java/issues/gh324/ObservableCache.java @@ -16,6 +16,7 @@ package issues.gh324; import org.apache.ibatis.cache.impl.PerpetualCache; +import org.jspecify.annotations.Nullable; public class ObservableCache extends PerpetualCache { @@ -48,7 +49,7 @@ public void putObject(Object key, Object value) { } @Override - public Object getObject(Object key) { + public @Nullable Object getObject(Object key) { Object answer = super.getObject(key); if (key.toString().contains("select id, name from NameTable where id = ?")) { diff --git a/src/test/java/issues/gh324/TestUtils.java b/src/test/java/issues/gh324/TestUtils.java index 23c191686..6c88093e9 100644 --- a/src/test/java/issues/gh324/TestUtils.java +++ b/src/test/java/issues/gh324/TestUtils.java @@ -19,12 +19,12 @@ public class TestUtils { public static void recordIsFred(NameRecord row) { - assertThat(row.getId()).isEqualTo(1); - assertThat(row.getName()).isEqualTo("Fred"); + assertThat(row.id()).isEqualTo(1); + assertThat(row.name()).isEqualTo("Fred"); } public static void recordIsBarney(NameRecord row) { - assertThat(row.getId()).isEqualTo(1); - assertThat(row.getName()).isEqualTo("Barney"); + assertThat(row.id()).isEqualTo(1); + assertThat(row.name()).isEqualTo("Barney"); } } diff --git a/src/test/java/issues/gh324/package-info.java b/src/test/java/issues/gh324/package-info.java new file mode 100644 index 000000000..72fdce9c1 --- /dev/null +++ b/src/test/java/issues/gh324/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package issues.gh324; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/issues/gh324/spring/SpringNameService.java b/src/test/java/issues/gh324/spring/SpringNameService.java index 9fbfdf03f..994bcf310 100644 --- a/src/test/java/issues/gh324/spring/SpringNameService.java +++ b/src/test/java/issues/gh324/spring/SpringNameService.java @@ -37,25 +37,19 @@ public class SpringNameService { @Transactional(propagation = Propagation.REQUIRES_NEW) public void insertRecord() { - NameRecord row = new NameRecord(); - row.setId(1); - row.setName("Fred"); + NameRecord row = new NameRecord(1, "Fred"); mapper.insert(row); } @Transactional(propagation = Propagation.REQUIRES_NEW) public void updateRecordAndCommit() { - NameRecord row = new NameRecord(); - row.setId(1); - row.setName("Barney"); + NameRecord row = new NameRecord(1, "Barney"); mapper.updateByPrimaryKey(row); } public void updateRecordAndRollback() { TransactionStatus txStatus = transactionManager.getTransaction(new DefaultTransactionDefinition()); - NameRecord row = new NameRecord(); - row.setId(1); - row.setName("Barney"); + NameRecord row = new NameRecord(1, "Barney"); mapper.updateByPrimaryKey(row); transactionManager.rollback(txStatus); } diff --git a/src/test/java/issues/lhg142/package-info.java b/src/test/java/issues/lhg142/package-info.java new file mode 100644 index 000000000..b28d6c387 --- /dev/null +++ b/src/test/java/issues/lhg142/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package issues.lhg142; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/delete/package-info.java b/src/test/java/org/mybatis/dynamic/sql/delete/package-info.java new file mode 100644 index 000000000..a7bfc9d26 --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/delete/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql.delete; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/insert/package-info.java b/src/test/java/org/mybatis/dynamic/sql/insert/package-info.java new file mode 100644 index 000000000..5ef9f74ea --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/insert/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql.insert; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/insert/render/package-info.java b/src/test/java/org/mybatis/dynamic/sql/insert/render/package-info.java new file mode 100644 index 000000000..02cfd6efa --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/insert/render/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql.insert.render; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/mybatis3/InsertStatementTest.java b/src/test/java/org/mybatis/dynamic/sql/mybatis3/InsertStatementTest.java index 5e0ef7f7b..77b63f65f 100644 --- a/src/test/java/org/mybatis/dynamic/sql/mybatis3/InsertStatementTest.java +++ b/src/test/java/org/mybatis/dynamic/sql/mybatis3/InsertStatementTest.java @@ -20,6 +20,7 @@ import java.sql.JDBCType; +import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.Test; import org.mybatis.dynamic.sql.SqlColumn; import org.mybatis.dynamic.sql.SqlTable; @@ -77,12 +78,12 @@ void testSelectiveInsertStatementBuilder() { } static class TestRecord { - private Integer id; - private String firstName; - private String lastName; - private String occupation; + private @Nullable Integer id; + private @Nullable String firstName; + private @Nullable String lastName; + private @Nullable String occupation; - Integer getId() { + @Nullable Integer getId() { return id; } @@ -90,7 +91,7 @@ void setId(Integer id) { this.id = id; } - String getFirstName() { + @Nullable String getFirstName() { return firstName; } @@ -98,7 +99,7 @@ void setFirstName(String firstName) { this.firstName = firstName; } - String getLastName() { + @Nullable String getLastName() { return lastName; } @@ -106,7 +107,7 @@ void setLastName(String lastName) { this.lastName = lastName; } - String getOccupation() { + @Nullable String getOccupation() { return occupation; } diff --git a/src/test/java/org/mybatis/dynamic/sql/mybatis3/package-info.java b/src/test/java/org/mybatis/dynamic/sql/mybatis3/package-info.java new file mode 100644 index 000000000..52eaa038c --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/mybatis3/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql.mybatis3; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/package-info.java b/src/test/java/org/mybatis/dynamic/sql/package-info.java new file mode 100644 index 000000000..7555e2e26 --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/select/package-info.java b/src/test/java/org/mybatis/dynamic/sql/select/package-info.java new file mode 100644 index 000000000..7e49fd4ec --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/select/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql.select; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/subselect/package-info.java b/src/test/java/org/mybatis/dynamic/sql/subselect/package-info.java new file mode 100644 index 000000000..2195e6c35 --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/subselect/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql.subselect; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/update/package-info.java b/src/test/java/org/mybatis/dynamic/sql/update/package-info.java new file mode 100644 index 000000000..b1b75a4f4 --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/update/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql.update; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/util/package-info.java b/src/test/java/org/mybatis/dynamic/sql/util/package-info.java new file mode 100644 index 000000000..82bcfdd13 --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/util/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql.util; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/where/condition/package-info.java b/src/test/java/org/mybatis/dynamic/sql/where/condition/package-info.java new file mode 100644 index 000000000..3457063de --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/where/condition/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql.where.condition; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/where/package-info.java b/src/test/java/org/mybatis/dynamic/sql/where/package-info.java new file mode 100644 index 000000000..194b40e86 --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/where/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql.where; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/java/org/mybatis/dynamic/sql/where/render/package-info.java b/src/test/java/org/mybatis/dynamic/sql/where/render/package-info.java new file mode 100644 index 000000000..cde1387a3 --- /dev/null +++ b/src/test/java/org/mybatis/dynamic/sql/where/render/package-info.java @@ -0,0 +1,19 @@ +/* + * Copyright 2016-2025 the original author or authors. + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@NullMarked +package org.mybatis.dynamic.sql.where.render; + +import org.jspecify.annotations.NullMarked; diff --git a/src/test/kotlin/examples/kotlin/mybatis3/mariadb/KIsLikeEscape.kt b/src/test/kotlin/examples/kotlin/mybatis3/mariadb/KIsLikeEscape.kt index 6746dc03e..52ddc9e7e 100644 --- a/src/test/kotlin/examples/kotlin/mybatis3/mariadb/KIsLikeEscape.kt +++ b/src/test/kotlin/examples/kotlin/mybatis3/mariadb/KIsLikeEscape.kt @@ -65,6 +65,6 @@ private class EmptyIsLikeEscape : KIsLikeEscape(-1) { private val EMPTY: KIsLikeEscape = EmptyIsLikeEscape() @Suppress("UNCHECKED_CAST") - internal fun empty(): KIsLikeEscape = EMPTY as KIsLikeEscape + fun empty(): KIsLikeEscape = EMPTY as KIsLikeEscape } }