From 8f757a5ec707f5f82f36f167755a3b95c4193905 Mon Sep 17 00:00:00 2001 From: altro3 Date: Sun, 29 Oct 2023 15:28:54 +0700 Subject: [PATCH] Remove semicolons from groovy files. Move tests from javax to jakarta. Remove unused imports. --- gradle/license.gradle | 22 +++++++++++++++++++ .../docs/guide/dataClassesValidation.adoc | 2 +- .../validation/custom/MyValidatorBean.groovy | 2 +- .../validation/iterable/BookInfoSpec.groovy | 2 +- .../docs/validation/custom/MyValidatorBean.kt | 3 +-- .../validation/PojoOptionalGetterSpec.java | 1 - .../tck/TckDeployableContainer.java | 3 +-- .../visitor/ValidatedParseSpec.groovy | 9 +++----- .../visitor/ValidatedParseSpecGroovy.groovy | 4 ---- .../DefaultConstraintValidatorContext.java | 4 ++-- .../DefaultConstraintViolationBuilder.java | 2 +- .../validator/DefaultValidator.java | 9 +------- .../validator/ExecutableMethodValidator.java | 2 +- .../validator/IntrospectedBeanDescriptor.java | 3 +-- .../validation/validator/ValidationPath.java | 2 +- .../validation/validator/Validator.java | 2 +- .../constraints/ConstraintValidator.java | 2 +- .../DefaultConstraintValidators.java | 2 +- .../validator/constraints/DomainNameUtil.java | 6 ++--- .../validation/BeanIntrospectionSpec.groovy | 6 ++--- .../groovy/io/micronaut/validation/Foo.java | 1 - ...nterfaceConfigurationPropertiesSpec.groovy | 4 ++-- .../executable/NullablePrimitiveSpec.groovy | 16 +++++++++----- .../WriteOnlyConfigPropertiesSpec.groovy | 2 +- .../validation/validator/ValidatorSpec.groovy | 6 ++--- .../validator/pojo/FavoriteWebsSpec.groovy | 2 +- .../pojo/PojoBodyParameterSpec.groovy | 6 ++--- .../validator/pojo/PojoValidatorSpec.groovy | 4 ++-- 28 files changed, 69 insertions(+), 60 deletions(-) create mode 100644 gradle/license.gradle diff --git a/gradle/license.gradle b/gradle/license.gradle new file mode 100644 index 00000000..5784a308 --- /dev/null +++ b/gradle/license.gradle @@ -0,0 +1,22 @@ +apply plugin: 'com.github.hierynomus.license' + +license { + header = rootProject.file('config/HEADER') + strictCheck = true + ignoreFailures = true + mapping { + kt = 'SLASHSTAR_STYLE' + java = 'SLASHSTAR_STYLE' + groovy = 'SLASHSTAR_STYLE' + } + ext.year = '2017-2023' + + exclude "**/transaction/**" + exclude '**/*.txt' + exclude '**/*.html' + exclude '**/*.xml' + exclude '**/*.json' + exclude '**/build-info.properties' + exclude '**/git.properties' + exclude '**/othergit.properties' +} diff --git a/src/main/docs/guide/dataClassesValidation.adoc b/src/main/docs/guide/dataClassesValidation.adoc index bc8e71e2..0803f13d 100644 --- a/src/main/docs/guide/dataClassesValidation.adoc +++ b/src/main/docs/guide/dataClassesValidation.adoc @@ -3,7 +3,7 @@ To validate data classes, e.g. POJOs (typically used in JSON interchange), the c .POJO Validation Example snippet::io.micronaut.docs.validation.Person[tags="class"] -TIP: The {coreDocsUrl}core/annotation/Introspected[@Introspected] annotation can be used as a meta-annotation; common annotations like `@javax.persistence.Entity` are treated as `@Introspected` +TIP: The {coreDocsUrl}core/annotation/Introspected[@Introspected] annotation can be used as a meta-annotation; common annotations like `@jakarta.persistence.Entity` are treated as `@Introspected` The above example defines a `Person` class that has two properties (`name` and `age`) that have constraints applied. Note that in Java the annotations can be on the field or the getter, and with Kotlin data classes, the annotation should target the field. diff --git a/test-suite-groovy/src/test/groovy/io/micronaut/docs/validation/custom/MyValidatorBean.groovy b/test-suite-groovy/src/test/groovy/io/micronaut/docs/validation/custom/MyValidatorBean.groovy index a6a40a9a..1c1ea2aa 100644 --- a/test-suite-groovy/src/test/groovy/io/micronaut/docs/validation/custom/MyValidatorBean.groovy +++ b/test-suite-groovy/src/test/groovy/io/micronaut/docs/validation/custom/MyValidatorBean.groovy @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.micronaut.docs.validation.custom; +package io.micronaut.docs.validation.custom // tag::imports[] diff --git a/test-suite-groovy/src/test/groovy/io/micronaut/docs/validation/iterable/BookInfoSpec.groovy b/test-suite-groovy/src/test/groovy/io/micronaut/docs/validation/iterable/BookInfoSpec.groovy index db769537..b00731ca 100644 --- a/test-suite-groovy/src/test/groovy/io/micronaut/docs/validation/iterable/BookInfoSpec.groovy +++ b/test-suite-groovy/src/test/groovy/io/micronaut/docs/validation/iterable/BookInfoSpec.groovy @@ -9,7 +9,7 @@ import spock.lang.Specification class BookInfoSpec extends Specification { @Inject - BookInfoService bookInfoService; + BookInfoService bookInfoService // tag::validate-iterables[] void testAuthorNamesAreValidated() { diff --git a/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/validation/custom/MyValidatorBean.kt b/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/validation/custom/MyValidatorBean.kt index 9953154f..2b042f50 100644 --- a/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/validation/custom/MyValidatorBean.kt +++ b/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/validation/custom/MyValidatorBean.kt @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.micronaut.docs.validation.custom; +package io.micronaut.docs.validation.custom // tag::imports[] -import io.micronaut.docs.validation.custom.DurationPattern import io.micronaut.core.annotation.AnnotationValue import io.micronaut.core.annotation.Introspected import io.micronaut.validation.validator.constraints.ConstraintValidator diff --git a/test-suite/src/test/java/io/micronaut/docs/validation/PojoOptionalGetterSpec.java b/test-suite/src/test/java/io/micronaut/docs/validation/PojoOptionalGetterSpec.java index 1dd5a521..6f31c804 100644 --- a/test-suite/src/test/java/io/micronaut/docs/validation/PojoOptionalGetterSpec.java +++ b/test-suite/src/test/java/io/micronaut/docs/validation/PojoOptionalGetterSpec.java @@ -3,7 +3,6 @@ import io.micronaut.context.annotation.Property; import io.micronaut.context.annotation.Requires; import io.micronaut.test.extensions.junit5.annotation.MicronautTest; -import jakarta.inject.Inject; import jakarta.inject.Singleton; import jakarta.validation.Valid; import org.junit.jupiter.api.Test; diff --git a/tests/jakarta-validation-tck/src/main/java/io/micronaut/validation/tck/TckDeployableContainer.java b/tests/jakarta-validation-tck/src/main/java/io/micronaut/validation/tck/TckDeployableContainer.java index db0ecab7..32f75c8b 100644 --- a/tests/jakarta-validation-tck/src/main/java/io/micronaut/validation/tck/TckDeployableContainer.java +++ b/tests/jakarta-validation-tck/src/main/java/io/micronaut/validation/tck/TckDeployableContainer.java @@ -103,10 +103,9 @@ public ProtocolDescription getDefaultProtocol() { } private static JavaArchive buildSupportLibrary() { - JavaArchive supportLib = ShrinkWrap.create(JavaArchive.class, "micronaut-validation-tck-support.jar") + return ShrinkWrap.create(JavaArchive.class, "micronaut-validation-tck-support.jar") .addAsManifestResource("META-INF/services/io.micronaut.inject.visitor.TypeElementVisitor") .addPackage(TestClassVisitor.class.getPackage()); - return supportLib; } @Override diff --git a/validation-processor/src/test/groovy/io/micronaut/validation/visitor/ValidatedParseSpec.groovy b/validation-processor/src/test/groovy/io/micronaut/validation/visitor/ValidatedParseSpec.groovy index 36abc0c5..90707f33 100644 --- a/validation-processor/src/test/groovy/io/micronaut/validation/visitor/ValidatedParseSpec.groovy +++ b/validation-processor/src/test/groovy/io/micronaut/validation/visitor/ValidatedParseSpec.groovy @@ -1,16 +1,13 @@ -package io.micronaut.validation +package io.micronaut.validation.visitor import io.micronaut.annotation.processing.test.AbstractTypeElementSpec import io.micronaut.inject.BeanDefinition -import io.micronaut.inject.ValidatedBeanDefinition -import io.micronaut.inject.validation.RequiresValidation import io.micronaut.inject.writer.BeanDefinitionVisitor -import jakarta.validation.Valid import java.time.LocalDate class ValidatedParseSpec extends AbstractTypeElementSpec { - final static String VALIDATED_ANN = "io.micronaut.validation.Validated"; + final static String VALIDATED_ANN = "io.micronaut.validation.Validated" void "test constraints on beans make them @Validated"() { given: @@ -77,7 +74,7 @@ class Test { } ''') when: - def method = definition.getRequiredMethod("setList", List); + def method = definition.getRequiredMethod("setList", List) then: method.hasStereotype(VALIDATED_ANN) diff --git a/validation-processor/src/test/groovy/io/micronaut/validation/visitor/ValidatedParseSpecGroovy.groovy b/validation-processor/src/test/groovy/io/micronaut/validation/visitor/ValidatedParseSpecGroovy.groovy index 67bdd6a6..776ba1b4 100644 --- a/validation-processor/src/test/groovy/io/micronaut/validation/visitor/ValidatedParseSpecGroovy.groovy +++ b/validation-processor/src/test/groovy/io/micronaut/validation/visitor/ValidatedParseSpecGroovy.groovy @@ -1,12 +1,8 @@ package io.micronaut.validation.visitor -import io.micronaut.aop.Around import io.micronaut.ast.transform.test.AbstractBeanDefinitionSpec import io.micronaut.core.beans.BeanIntrospection -import io.micronaut.inject.ProxyBeanDefinition import io.micronaut.inject.writer.BeanDefinitionVisitor -import io.micronaut.inject.writer.BeanDefinitionWriter -import io.micronaut.validation.ValidatedParseSpec import java.time.LocalDate diff --git a/validation/src/main/java/io/micronaut/validation/validator/DefaultConstraintValidatorContext.java b/validation/src/main/java/io/micronaut/validation/validator/DefaultConstraintValidatorContext.java index f1ab6cb8..d3427e99 100644 --- a/validation/src/main/java/io/micronaut/validation/validator/DefaultConstraintValidatorContext.java +++ b/validation/src/main/java/io/micronaut/validation/validator/DefaultConstraintValidatorContext.java @@ -166,13 +166,13 @@ public ValidationCloseable validating(Object obj) { public ValidationCloseable withExecutableParameterValues(Object[] executableParameterValues) { Object[] prevExecutableParameterValues = this.executableParameterValues; this.executableParameterValues = executableParameterValues; - return () -> DefaultConstraintValidatorContext.this.executableParameterValues = prevExecutableParameterValues; + return () -> this.executableParameterValues = prevExecutableParameterValues; } public ValidationCloseable withExecutableReturnValue(Object executableReturnValue) { Object prevExecutableReturnValue = this.executableReturnValue; this.executableReturnValue = executableReturnValue; - return () -> DefaultConstraintValidatorContext.this.executableReturnValue = prevExecutableReturnValue; + return () -> this.executableReturnValue = prevExecutableReturnValue; } public GroupsValidation withGroupSequence(@NonNull ValidationGroup validationGroup) { diff --git a/validation/src/main/java/io/micronaut/validation/validator/DefaultConstraintViolationBuilder.java b/validation/src/main/java/io/micronaut/validation/validator/DefaultConstraintViolationBuilder.java index 5ad08ee9..eb262ef8 100644 --- a/validation/src/main/java/io/micronaut/validation/validator/DefaultConstraintViolationBuilder.java +++ b/validation/src/main/java/io/micronaut/validation/validator/DefaultConstraintViolationBuilder.java @@ -25,7 +25,7 @@ import jakarta.validation.metadata.ConstraintDescriptor; /** - * The default implementation {@link jakarta.validation.ConstraintValidatorContext.ConstraintViolationBuilder}. + * The default implementation {@link ConstraintValidatorContext.ConstraintViolationBuilder}. * * @param The result type * @author Denis Stepnov diff --git a/validation/src/main/java/io/micronaut/validation/validator/DefaultValidator.java b/validation/src/main/java/io/micronaut/validation/validator/DefaultValidator.java index 7fd62250..a58a53ef 100644 --- a/validation/src/main/java/io/micronaut/validation/validator/DefaultValidator.java +++ b/validation/src/main/java/io/micronaut/validation/validator/DefaultValidator.java @@ -175,7 +175,6 @@ public Set> validate(@NonNull T object, @Nullable Cla * @return The constraint violations */ @Override - @SuppressWarnings("ConstantConditions") @NonNull public Set> validate(@NonNull BeanIntrospection introspection, @NonNull T object, @@ -511,7 +510,6 @@ public Set> validateConstructorParameters(Class[] groups) { requireNonNull("groups", groups); - //noinspection ConstantConditions parameterValues = parameterValues != null ? parameterValues : ArrayUtils.EMPTY_OBJECT_ARRAY; final int argLength = constructorArguments.length; if (parameterValues.length != argLength) { @@ -730,7 +728,6 @@ public void validateBean(@NonNull BeanResolutionContext resolutionContext, @Nullable protected BeanIntrospection getBeanIntrospection(@NonNull T object, @NonNull Class definedClass) { - //noinspection ConstantConditions if (object == null) { return null; } @@ -748,7 +745,6 @@ protected BeanIntrospection getBeanIntrospection(@NonNull T object, @SuppressWarnings({"WeakerAccess", "unchecked"}) @Nullable protected BeanIntrospection getBeanIntrospection(@NonNull T object) { - //noinspection ConstantConditions if (object == null) { return null; } @@ -1471,10 +1467,7 @@ private List> getConstraints(Default (AnnotationValue) annotationValue, annotationMetadata )) - .filter(annotationValue -> { - boolean constraintIncluded = isConstraintIncluded(context, annotationValue); - return constraintIncluded; - }); + .filter(annotationValue -> isConstraintIncluded(context, annotationValue)); }) .toList(); } diff --git a/validation/src/main/java/io/micronaut/validation/validator/ExecutableMethodValidator.java b/validation/src/main/java/io/micronaut/validation/validator/ExecutableMethodValidator.java index 48944cf2..45cc2188 100644 --- a/validation/src/main/java/io/micronaut/validation/validator/ExecutableMethodValidator.java +++ b/validation/src/main/java/io/micronaut/validation/validator/ExecutableMethodValidator.java @@ -31,7 +31,7 @@ import java.util.Set; /** - * Extended version of {@link ExecutableValidator} that operates on {@link io.micronaut.inject.ExecutableMethod} instances. + * Extended version of {@link ExecutableValidator} that operates on {@link ExecutableMethod} instances. * * @author graemerocher * @since 1.2 diff --git a/validation/src/main/java/io/micronaut/validation/validator/IntrospectedBeanDescriptor.java b/validation/src/main/java/io/micronaut/validation/validator/IntrospectedBeanDescriptor.java index fd8f1f6c..6b447ab9 100644 --- a/validation/src/main/java/io/micronaut/validation/validator/IntrospectedBeanDescriptor.java +++ b/validation/src/main/java/io/micronaut/validation/validator/IntrospectedBeanDescriptor.java @@ -197,12 +197,11 @@ public Set> getConstraintDescriptors() { return beanProperty.getAnnotationTypesByStereotype(Constraint.class) .stream().flatMap(type -> beanProperty.getAnnotationValuesByType(type).stream().map(annotationValue -> { AnnotationValue annotation = beanProperty.getAnnotation(type); - DefaultConstraintDescriptor descriptor = new DefaultConstraintDescriptor( + return (DefaultConstraintDescriptor) new DefaultConstraintDescriptor( type, annotation, beanProperty ); - return descriptor; })).collect(Collectors.toSet()); } diff --git a/validation/src/main/java/io/micronaut/validation/validator/ValidationPath.java b/validation/src/main/java/io/micronaut/validation/validator/ValidationPath.java index 5c897646..17f3436f 100644 --- a/validation/src/main/java/io/micronaut/validation/validator/ValidationPath.java +++ b/validation/src/main/java/io/micronaut/validation/validator/ValidationPath.java @@ -105,7 +105,7 @@ public String toString() { ContextualPath withContainerContext(ContainerContext containerContext) { ContainerContext prevContainerContext = this.containerContext; this.containerContext = containerContext; - return () -> ValidationPath.this.containerContext = prevContainerContext; + return () -> this.containerContext = prevContainerContext; } ContextualPath addBeanNode() { diff --git a/validation/src/main/java/io/micronaut/validation/validator/Validator.java b/validation/src/main/java/io/micronaut/validation/validator/Validator.java index 66404444..8291e604 100644 --- a/validation/src/main/java/io/micronaut/validation/validator/Validator.java +++ b/validation/src/main/java/io/micronaut/validation/validator/Validator.java @@ -25,7 +25,7 @@ import java.util.Set; /** - * Extended version of the {@link jakarta.validation.Valid} interface for Micronaut's implementation. + * Extended version of the {@link Valid} interface for Micronaut's implementation. * *

The {@link #getConstraintsForClass(Class)} method is not supported by the implementation.

* diff --git a/validation/src/main/java/io/micronaut/validation/validator/constraints/ConstraintValidator.java b/validation/src/main/java/io/micronaut/validation/validator/constraints/ConstraintValidator.java index 013ac622..6bd30982 100644 --- a/validation/src/main/java/io/micronaut/validation/validator/constraints/ConstraintValidator.java +++ b/validation/src/main/java/io/micronaut/validation/validator/constraints/ConstraintValidator.java @@ -27,7 +27,7 @@ /** * Constraint validator that can be used at either runtime or compilation time and - * is capable of validation {@link jakarta.validation.Constraint} instances. Allows defining validators that work with both Hibernate validator and Micronaut's validator. + * is capable of validation {@link Constraint} instances. Allows defining validators that work with both Hibernate validator and Micronaut's validator. * *

Unlike the specification's interface this one can uses as a functional interface. Implementor should not implement the {@link #initialize(Annotation)} method and should instead read the passed {@link AnnotationValue}.

* diff --git a/validation/src/main/java/io/micronaut/validation/validator/constraints/DefaultConstraintValidators.java b/validation/src/main/java/io/micronaut/validation/validator/constraints/DefaultConstraintValidators.java index a5327325..ae28cfe6 100644 --- a/validation/src/main/java/io/micronaut/validation/validator/constraints/DefaultConstraintValidators.java +++ b/validation/src/main/java/io/micronaut/validation/validator/constraints/DefaultConstraintValidators.java @@ -45,7 +45,7 @@ /** * A factory bean that contains implementation for many of the default validations. - * This approach is preferred as it generates less classes and smaller byte code than defining a + * This approach is preferred as it generates fewer classes and smaller byte code than defining a * validator class for each case. * * @author graemerocher diff --git a/validation/src/main/java/io/micronaut/validation/validator/constraints/DomainNameUtil.java b/validation/src/main/java/io/micronaut/validation/validator/constraints/DomainNameUtil.java index 91204f9b..52bdffee 100644 --- a/validation/src/main/java/io/micronaut/validation/validator/constraints/DomainNameUtil.java +++ b/validation/src/main/java/io/micronaut/validation/validator/constraints/DomainNameUtil.java @@ -44,20 +44,20 @@ public final class DomainNameUtil { private static final String IP_V6_DOMAIN = "(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))"; /** - * Regular expression for the domain part of an URL + * Regular expression for the domain part of a URL *

* A host string must be a domain string, an IPv4 address string, or "[", followed by an IPv6 address string, * followed by "]". */ private static final Pattern DOMAIN_PATTERN = Pattern.compile( - DOMAIN + "|\\[" + IP_V6_DOMAIN + "\\]", CASE_INSENSITIVE + DOMAIN + "|\\[" + IP_V6_DOMAIN + "]", CASE_INSENSITIVE ); /** * Regular expression for the domain part of an email address (everything after '@'). */ private static final Pattern EMAIL_DOMAIN_PATTERN = Pattern.compile( - DOMAIN + "|\\[" + IP_DOMAIN + "\\]|" + "\\[IPv6:" + IP_V6_DOMAIN + "\\]", CASE_INSENSITIVE + DOMAIN + "|\\[" + IP_DOMAIN + "]|" + "\\[IPv6:" + IP_V6_DOMAIN + "]", CASE_INSENSITIVE ); private DomainNameUtil() { diff --git a/validation/src/test/groovy/io/micronaut/validation/BeanIntrospectionSpec.groovy b/validation/src/test/groovy/io/micronaut/validation/BeanIntrospectionSpec.groovy index c8195db9..74412968 100644 --- a/validation/src/test/groovy/io/micronaut/validation/BeanIntrospectionSpec.groovy +++ b/validation/src/test/groovy/io/micronaut/validation/BeanIntrospectionSpec.groovy @@ -1,10 +1,10 @@ package io.micronaut.validation - import io.micronaut.annotation.processing.TypeElementVisitorProcessor import io.micronaut.annotation.processing.test.AbstractTypeElementSpec import io.micronaut.annotation.processing.test.JavaParser import io.micronaut.context.annotation.Replaces +import io.micronaut.context.annotation.Requires import io.micronaut.context.visitor.ConfigurationReaderVisitor import io.micronaut.core.beans.BeanIntrospection import io.micronaut.core.beans.BeanIntrospectionReference @@ -692,7 +692,7 @@ interface GroupTwo {} interface GroupThree {} ''') def clazz = context.classLoader.loadClass('test.$Address$IntrospectionRef') - BeanIntrospectionReference reference = clazz.newInstance() + BeanIntrospectionReference reference = clazz.getDeclaredConstructor().newInstance() expect: @@ -767,7 +767,7 @@ class Book { @Singleton @Replaces(BeanIntrospectionModule) - @io.micronaut.context.annotation.Requires(property = "bean.introspection.test") + @Requires(property = "bean.introspection.test") static class StaticBeanIntrospectionModule extends BeanIntrospectionModule { Map, BeanIntrospection> introspectionMap = [:] @Override diff --git a/validation/src/test/groovy/io/micronaut/validation/Foo.java b/validation/src/test/groovy/io/micronaut/validation/Foo.java index ef5fcb56..454e9d9f 100644 --- a/validation/src/test/groovy/io/micronaut/validation/Foo.java +++ b/validation/src/test/groovy/io/micronaut/validation/Foo.java @@ -15,7 +15,6 @@ */ package io.micronaut.validation; -import io.micronaut.context.annotation.Executable; import io.micronaut.core.annotation.Introspected; import jakarta.inject.Singleton; diff --git a/validation/src/test/groovy/io/micronaut/validation/InterfaceConfigurationPropertiesSpec.groovy b/validation/src/test/groovy/io/micronaut/validation/InterfaceConfigurationPropertiesSpec.groovy index 13f71ce0..347a0132 100644 --- a/validation/src/test/groovy/io/micronaut/validation/InterfaceConfigurationPropertiesSpec.groovy +++ b/validation/src/test/groovy/io/micronaut/validation/InterfaceConfigurationPropertiesSpec.groovy @@ -72,7 +72,7 @@ import java.util.Optional; @ConfigurationProperties("foo.bar") @Executable interface MyConfig { - @javax.annotation.Nullable + @jakarta.annotation.Nullable String getHost(); @jakarta.validation.constraints.Min(10L) @@ -278,7 +278,7 @@ interface MyConfig { ''') then: def e = thrown(RuntimeException) - e.message.contains('Only getter methods are allowed on @ConfigurationProperties interfaces: junk(java.lang.String). You can change the accessors using @AccessorsStyle annotation'); + e.message.contains('Only getter methods are allowed on @ConfigurationProperties interfaces: junk(java.lang.String). You can change the accessors using @AccessorsStyle annotation') } void "test getter that returns void method"() { diff --git a/validation/src/test/groovy/io/micronaut/validation/executable/NullablePrimitiveSpec.groovy b/validation/src/test/groovy/io/micronaut/validation/executable/NullablePrimitiveSpec.groovy index 00bd2b6f..df47bbc6 100644 --- a/validation/src/test/groovy/io/micronaut/validation/executable/NullablePrimitiveSpec.groovy +++ b/validation/src/test/groovy/io/micronaut/validation/executable/NullablePrimitiveSpec.groovy @@ -48,10 +48,10 @@ class NullablePrimitiveSpec extends AbstractTypeElementSpec { where: deprecated | annotation - false | 'javax.annotation.Nullable' + false | 'jakarta.annotation.Nullable' false | 'io.micronaut.core.annotation.Nullable' false | 'edu.umd.cs.findbugs.annotations.Nullable' - false | 'javax.annotation.Nonnull' + false | 'jakarta.annotation.Nonnull' false | 'io.micronaut.core.annotation.NonNull' false | 'edu.umd.cs.findbugs.annotations.NonNull' } @@ -81,7 +81,9 @@ class NullablePrimitiveSpec extends AbstractTypeElementSpec { output.contains(warning) where: - annotation << ['@javax.annotation.Nullable', '@io.micronaut.core.annotation.Nullable', '@edu.umd.cs.findbugs.annotations.Nullable'] + annotation << ['@jakarta.annotation.Nullable', + '@io.micronaut.core.annotation.Nullable', + '@edu.umd.cs.findbugs.annotations.Nullable'] } @Unroll @@ -109,7 +111,9 @@ class NullablePrimitiveSpec extends AbstractTypeElementSpec { !output.contains(warning) where: - annotation << ['@javax.annotation.Nullable', '@io.micronaut.core.annotation.Nullable', '@edu.umd.cs.findbugs.annotations.Nullable'] + annotation << ['@jakarta.annotation.Nullable', + '@io.micronaut.core.annotation.Nullable', + '@edu.umd.cs.findbugs.annotations.Nullable'] } @Unroll @@ -132,7 +136,9 @@ class NullablePrimitiveSpec extends AbstractTypeElementSpec { !output.contains(warning) where: - annotation << ['@javax.annotation.Nullable', '@io.micronaut.core.annotation.Nullable', '@edu.umd.cs.findbugs.annotations.Nullable'] + annotation << ['@jakarta.annotation.Nullable', + '@io.micronaut.core.annotation.Nullable', + '@edu.umd.cs.findbugs.annotations.Nullable'] } } diff --git a/validation/src/test/groovy/io/micronaut/validation/properties/WriteOnlyConfigPropertiesSpec.groovy b/validation/src/test/groovy/io/micronaut/validation/properties/WriteOnlyConfigPropertiesSpec.groovy index d949f088..f6726969 100644 --- a/validation/src/test/groovy/io/micronaut/validation/properties/WriteOnlyConfigPropertiesSpec.groovy +++ b/validation/src/test/groovy/io/micronaut/validation/properties/WriteOnlyConfigPropertiesSpec.groovy @@ -1,4 +1,4 @@ -package io.micronaut.validation.properties; +package io.micronaut.validation.properties import io.micronaut.context.ApplicationContext import io.micronaut.context.exceptions.BeanInstantiationException diff --git a/validation/src/test/groovy/io/micronaut/validation/validator/ValidatorSpec.groovy b/validation/src/test/groovy/io/micronaut/validation/validator/ValidatorSpec.groovy index 11a6d322..8b57ab0c 100644 --- a/validation/src/test/groovy/io/micronaut/validation/validator/ValidatorSpec.groovy +++ b/validation/src/test/groovy/io/micronaut/validation/validator/ValidatorSpec.groovy @@ -132,7 +132,7 @@ class ValidatorSpec extends Specification { void "test validate bean property doesn't cascade"() { given: - Book b = new Book(primaryAuthor: new Author(name: "", age: 200)); + Book b = new Book(primaryAuthor: new Author(name: "", age: 200)) def violations = validator.validateProperty(b, "primaryAuthor") expect: @@ -304,7 +304,7 @@ class ValidatorSpec extends Specification { void "test validate property argument cascade"() { given: def book = new ValidatorSpecClasses.Book("LOTR", [new ValidatorSpecClasses.Author("")]) - def violations = validator.validate(book); + def violations = validator.validate(book) expect: violations.size() == 1 @@ -394,7 +394,7 @@ class ValidatorSpec extends Specification { given: var matrix = new ValidatorSpecClasses.PositiveMatrix([[1, -1], [-3, 4]]) var violations = validator.validate(matrix) - violations = violations.sort{it -> it.getPropertyPath().toString(); } + violations = violations.sort{it -> it.getPropertyPath().toString() } expect: violations.size() == 2 diff --git a/validation/src/test/groovy/io/micronaut/validation/validator/pojo/FavoriteWebsSpec.groovy b/validation/src/test/groovy/io/micronaut/validation/validator/pojo/FavoriteWebsSpec.groovy index 2f9d63e6..d245670a 100644 --- a/validation/src/test/groovy/io/micronaut/validation/validator/pojo/FavoriteWebsSpec.groovy +++ b/validation/src/test/groovy/io/micronaut/validation/validator/pojo/FavoriteWebsSpec.groovy @@ -55,7 +55,7 @@ class FavoriteWebs { @Requires(property = "spec.name", value = "customValidatorField") class ValidURLsValidatorFactory { - private static final Pattern URL = Pattern.compile("(http:\\/\\/|https:\\/\\/)?(www.)?([a-zA-Z0-9]+).[a-zA-Z0-9]*.[a-z]{3}.?([a-z]+)?"); + private static final Pattern URL = Pattern.compile("(http:\\/\\/|https:\\/\\/)?(www.)?([a-zA-Z0-9]+).[a-zA-Z0-9]*.[a-z]{3}.?([a-z]+)?") @Singleton ConstraintValidator> validURLValidator() { diff --git a/validation/src/test/groovy/io/micronaut/validation/validator/pojo/PojoBodyParameterSpec.groovy b/validation/src/test/groovy/io/micronaut/validation/validator/pojo/PojoBodyParameterSpec.groovy index 5573e8b7..f69b2a18 100644 --- a/validation/src/test/groovy/io/micronaut/validation/validator/pojo/PojoBodyParameterSpec.groovy +++ b/validation/src/test/groovy/io/micronaut/validation/validator/pojo/PojoBodyParameterSpec.groovy @@ -195,7 +195,7 @@ class PojoBodyParameterSpec extends Specification { @JsonSubTypes.Type(value = ByNullableValue.class, name = "NULLABLE")]) abstract class SearchBy { @NotEmpty - String requiredVal; + String requiredVal } @@ -208,13 +208,13 @@ class ByName extends SearchBy { @Introspected class ByAge extends SearchBy { @NotNull - Integer age; + Integer age } @Introspected class ByNullableValue extends SearchBy { @NotNull(groups = TestGroup) - String nullableValue; + String nullableValue } interface TestGroup extends Default {} diff --git a/validation/src/test/groovy/io/micronaut/validation/validator/pojo/PojoValidatorSpec.groovy b/validation/src/test/groovy/io/micronaut/validation/validator/pojo/PojoValidatorSpec.groovy index 031d5860..c50f0846 100644 --- a/validation/src/test/groovy/io/micronaut/validation/validator/pojo/PojoValidatorSpec.groovy +++ b/validation/src/test/groovy/io/micronaut/validation/validator/pojo/PojoValidatorSpec.groovy @@ -147,9 +147,9 @@ class Search { @Introspected class SearchAny { @Valid - List searches; + List searches SearchAny(Search... searches) { - this.searches = searches; + this.searches = searches } }