From 4795fd090c3191468bdc350ef3ef3d44c5264876 Mon Sep 17 00:00:00 2001 From: Artur Date: Fri, 20 Dec 2024 18:04:55 +0200 Subject: [PATCH] feat: Use and recommend org.jspecify.annotations.NonNull instead of a custom one (#3046) --- packages/java/endpoint/pom.xml | 12 +-- .../main/java/com/vaadin/hilla/Nonnull.java | 4 + .../main/java/com/vaadin/hilla/Nullable.java | 4 + .../com/vaadin/hilla/crud/CountService.java | 3 +- .../hilla/crud/CrudRepositoryService.java | 6 +- .../com/vaadin/hilla/crud/FormService.java | 2 +- .../hilla/crud/ListRepositoryService.java | 3 +- .../com/vaadin/hilla/crud/ListService.java | 11 +-- .../ExplicitNullableTypeCheckerTest.java | 8 +- .../java/com/vaadin/hilla/NonnullEntity.java | 10 ++- .../com/vaadin/hilla/NonnullParserTest.java | 18 ++-- .../vaadin/hilla/NonnullReflectionTest.java | 11 +-- packages/java/engine-core/pom.xml | 4 +- .../hilla/engine/GeneratorConfiguration.java | 6 +- .../hilla/engine/GeneratorProcessor.java | 4 +- .../hilla/engine/ParserConfiguration.java | 8 +- .../vaadin/hilla/engine/ParserProcessor.java | 12 +-- packages/java/engine-runtime/pom.xml | 4 +- .../internal/TaskGenerateOpenAPIImpl.java | 4 +- .../hilla/gradle/plugin/SingleModuleTest.kt | 6 +- packages/java/maven-plugin/pom.xml | 4 +- packages/java/parser-jvm-core/pom.xml | 4 +- .../parser/core/AbstractCompositePlugin.java | 14 +-- .../hilla/parser/core/AbstractNode.java | 4 +- .../hilla/parser/core/NodeDependencies.java | 40 ++++----- .../vaadin/hilla/parser/core/NodePath.java | 10 +-- .../com/vaadin/hilla/parser/core/Parser.java | 90 +++++++++---------- .../com/vaadin/hilla/parser/core/Plugin.java | 12 +-- .../hilla/parser/core/PluginExecutor.java | 20 ++--- .../vaadin/hilla/parser/core/RootNode.java | 4 +- .../parser/models/AnnotatedAbstractModel.java | 4 +- .../parser/models/AnnotationInfoModel.java | 6 +- .../AnnotationParameterEnumValueModel.java | 6 +- .../models/AnnotationParameterModel.java | 10 +-- .../parser/models/ArraySignatureModel.java | 6 +- .../parser/models/BaseSignatureModel.java | 8 +- .../hilla/parser/models/ClassInfoModel.java | 6 +- .../ClassRefSignatureArtificialModel.java | 8 +- .../parser/models/ClassRefSignatureModel.java | 14 +-- .../hilla/parser/models/FieldInfoModel.java | 6 +- .../hilla/parser/models/MethodInfoModel.java | 6 +- .../models/MethodParameterInfoModel.java | 6 +- .../hilla/parser/models/SignatureModel.java | 6 +- .../parser/models/TypeArgumentModel.java | 6 +- .../parser/models/TypeParameterModel.java | 6 +- .../models/TypeParameterSourceModel.java | 4 +- .../parser/models/TypeVariableModel.java | 6 +- .../models/jackson/JacksonPropertyModel.java | 4 +- .../src/main/java/module-info.java | 2 +- .../hilla/parser/core/ParserConfigTests.java | 14 +-- .../hilla/parser/core/basic/AddPlugin.java | 6 +- .../parser/core/basic/FinalizePlugin.java | 6 +- .../hilla/parser/core/basic/RemovePlugin.java | 6 +- .../parser/core/basic/ReplacePlugin.java | 12 +-- .../dependency/DependencyEntityThree.java | 4 +- .../core/dependency/DependencyEntityTwo.java | 4 +- .../core/dependency/DependencyPlugin.java | 6 +- .../dependency/PluginDependencyEntity.java | 4 +- .../hilla/parser/test/nodes/EndpointNode.java | 8 +- .../hilla/parser/test/nodes/EntityNode.java | 10 +-- .../hilla/parser/test/nodes/FieldNode.java | 8 +- .../hilla/parser/test/nodes/MethodNode.java | 10 +-- .../test/nodes/MethodParameterNode.java | 8 +- .../parser/test/nodes/TypeSignatureNode.java | 10 +-- .../java/parser-jvm-plugin-backbone/pom.xml | 4 +- .../backbone/EndpointExposedPlugin.java | 14 +-- .../plugins/backbone/EndpointPlugin.java | 6 +- .../parser/plugins/backbone/EntityPlugin.java | 6 +- .../plugins/backbone/JsonValuePlugin.java | 12 +-- .../backbone/MethodParameterPlugin.java | 6 +- .../parser/plugins/backbone/MethodPlugin.java | 6 +- .../plugins/backbone/PropertyPlugin.java | 8 +- .../plugins/backbone/TypeSignaturePlugin.java | 6 +- .../nodes/CompositeTypeSignatureNode.java | 16 ++-- .../backbone/nodes/EndpointExposedNode.java | 8 +- .../plugins/backbone/nodes/EndpointNode.java | 8 +- .../nodes/EndpointNonExposedNode.java | 8 +- .../backbone/nodes/EndpointSignatureNode.java | 8 +- .../plugins/backbone/nodes/EntityNode.java | 10 +-- .../plugins/backbone/nodes/MethodNode.java | 10 +-- .../backbone/nodes/MethodParameterNode.java | 8 +- .../plugins/backbone/nodes/PropertyNode.java | 10 +-- .../backbone/nodes/TypeSignatureNode.java | 10 +-- .../plugins/backbone/nodes/TypedNode.java | 8 +- .../src/main/java/module-info.java | 2 +- .../backbone/superclassmethods/PagedData.java | 6 +- packages/java/parser-jvm-plugin-model/pom.xml | 4 +- .../parser/plugins/model/Annotation.java | 6 +- .../parser/plugins/model/ModelPlugin.java | 6 +- .../plugins/model/ValidationConstraint.java | 6 +- .../src/main/java/module-info.java | 2 +- .../java/parser-jvm-plugin-nonnull/pom.xml | 4 +- .../plugins/nonnull/AnnotationMatcher.java | 4 +- .../parser/plugins/nonnull/NonnullPlugin.java | 8 +- .../plugins/nonnull/NonnullPluginConfig.java | 6 +- .../src/main/java/module-info.java | 2 +- .../plugins/nonnull/basic/BasicEndpoint.java | 10 +-- .../java/parser-jvm-plugin-subtypes/pom.xml | 4 +- .../plugins/subtypes/SubTypesPlugin.java | 14 +-- .../src/main/java/module-info.java | 2 +- .../parser-jvm-plugin-transfertypes/pom.xml | 4 +- .../transfertypes/TransferTypesPlugin.java | 6 +- .../src/main/java/module-info.java | 2 +- packages/java/parser-jvm-test-utils/pom.xml | 4 +- .../TestEngineConfigurationPathResolver.java | 4 +- .../src/main/java/module-info.java | 2 +- packages/java/parser-jvm-utils/pom.xml | 4 +- .../src/main/java/module-info.java | 2 +- .../java/runtime-plugin-transfertypes/pom.xml | 4 +- .../com/vaadin/hilla/mappedtypes/Order.java | 6 +- .../vaadin/hilla/mappedtypes/Pageable.java | 4 +- .../com/vaadin/hilla/mappedtypes/Sort.java | 4 +- .../src/main/java/module-info.java | 2 +- .../test/endpoint/HelloReactEndpoint.java | 7 +- .../test/endpoint/HelloReactEndpoint.java | 7 +- .../com/vaadin/flow/connect/AppEndpoint.java | 8 +- .../flow/connect/AnnotatedEndpoint.java | 11 +-- .../com/vaadin/flow/connect/AppEndpoint.java | 5 +- .../com/vaadin/flow/connect/FluxEndpoint.java | 21 +++-- .../flow/connect/PackagePrivateEndpoint.java | 4 +- .../vaadin/flow/connect/PagedEndpoint.java | 19 ++-- .../application/endpoints/ChatService.java | 9 +- .../service/GreetingService.java | 5 +- pom.xml | 5 ++ 124 files changed, 507 insertions(+), 478 deletions(-) diff --git a/packages/java/endpoint/pom.xml b/packages/java/endpoint/pom.xml index 5465508c23..13f9548458 100644 --- a/packages/java/endpoint/pom.xml +++ b/packages/java/endpoint/pom.xml @@ -44,6 +44,10 @@ hilla-engine-core ${project.version} + + org.jspecify + jspecify + @@ -66,14 +70,6 @@ test - - com.google.code.findbugs - annotations - 3.0.1 - test - - - jakarta.validation diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/Nonnull.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/Nonnull.java index 24d9c099b4..b4c275a2c8 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/Nonnull.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/Nonnull.java @@ -28,9 +28,13 @@ * * This annotation exists only for convenience because the traditional * `jakarta.annotation.Nonnull` annotation is not applicable to type parameters. + * + * @deprecated use the standardized {@link org.jspecify.annotations.NonNull} + * instead */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE_USE }) +@Deprecated(forRemoval = true) public @interface Nonnull { } diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/Nullable.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/Nullable.java index 8e8f1a51c9..1478fde2f0 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/Nullable.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/Nullable.java @@ -29,9 +29,13 @@ * This annotation exists only for convenience because the traditional * `jakarta.annotation.Nullable` annotation is not applicable to type * parameters. + * + * @deprecated use the standardized {@link org.jspecify.annotations.Nullable} + * instead */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE_USE }) +@Deprecated(forRemoval = true) public @interface Nullable { } diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CountService.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CountService.java index 953861ee6a..cf7b0dd7bf 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CountService.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CountService.java @@ -1,8 +1,9 @@ package com.vaadin.hilla.crud; -import com.vaadin.hilla.Nullable; import com.vaadin.hilla.crud.filter.Filter; +import org.jspecify.annotations.Nullable; + /** * A browser-callable service that can count the given type of objects with a * given filter. diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CrudRepositoryService.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CrudRepositoryService.java index cc9dcd8c1e..f28f9a16c0 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CrudRepositoryService.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CrudRepositoryService.java @@ -3,11 +3,11 @@ import java.util.ArrayList; import java.util.List; -import com.vaadin.hilla.EndpointExposed; -import com.vaadin.hilla.Nullable; -import com.vaadin.hilla.crud.filter.Filter; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.repository.CrudRepository; +import org.jspecify.annotations.Nullable; + +import com.vaadin.hilla.EndpointExposed; /** * A browser-callable service that delegates crud operations to a JPA diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/FormService.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/FormService.java index 1b1947c5ee..75ebb350f7 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/FormService.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/FormService.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.crud; -import com.vaadin.hilla.Nullable; +import org.jspecify.annotations.Nullable; /** * A browser-callable service that can create, update, and delete a given type diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/ListRepositoryService.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/ListRepositoryService.java index 01539fc2c9..8ebfb63f31 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/ListRepositoryService.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/ListRepositoryService.java @@ -8,8 +8,9 @@ import com.googlecode.gentyref.GenericTypeReflector; import com.vaadin.hilla.EndpointExposed; -import com.vaadin.hilla.Nullable; import com.vaadin.hilla.crud.filter.Filter; + +import org.jspecify.annotations.Nullable; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.data.domain.Pageable; diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/ListService.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/ListService.java index 84e2bbdf73..af8baf3140 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/ListService.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/ListService.java @@ -2,11 +2,12 @@ import java.util.List; -import com.vaadin.hilla.Nonnull; -import com.vaadin.hilla.Nullable; -import com.vaadin.hilla.crud.filter.Filter; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; import org.springframework.data.domain.Pageable; +import com.vaadin.hilla.crud.filter.Filter; + /** * A browser-callable service that can list the given type of object. */ @@ -21,7 +22,7 @@ public interface ListService { * the filter to apply or {@code null} to not filter * @return a list of objects or an empty list if no objects were found */ - @Nonnull - List<@Nonnull T> list(Pageable pageable, @Nullable Filter filter); + @NonNull + List<@NonNull T> list(Pageable pageable, @Nullable Filter filter); } diff --git a/packages/java/endpoint/src/test/java/com/vaadin/hilla/ExplicitNullableTypeCheckerTest.java b/packages/java/endpoint/src/test/java/com/vaadin/hilla/ExplicitNullableTypeCheckerTest.java index 4e9c839ac3..6520be06d5 100644 --- a/packages/java/endpoint/src/test/java/com/vaadin/hilla/ExplicitNullableTypeCheckerTest.java +++ b/packages/java/endpoint/src/test/java/com/vaadin/hilla/ExplicitNullableTypeCheckerTest.java @@ -31,7 +31,7 @@ import java.util.Map; import java.util.Optional; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import org.junit.Assert; import org.junit.Before; @@ -406,7 +406,7 @@ public void should_InvokeCheckValueForType_When_AnnotatedNonnull() .checkValueForAnnotatedElement(notNullValue, getClass().getMethod("stringNonnull"), false); - Assert.assertNull("Should allow values with @Nonnull", error); + Assert.assertNull("Should allow values with @NonNull", error); verify(explicitNullableTypeChecker).checkValueForType(notNullValue, String.class, false); @@ -500,7 +500,7 @@ public Long methodWithIdAnnotation() { /** * Method for testing */ - @Nonnull + @javax.annotation.Nonnull public String stringNonnull() { return ""; } @@ -511,7 +511,7 @@ static private class Bean { public String ignoreProperty; public String description; transient String transientProperty; - @Nonnull + @NonNull private String title; public Bean() { diff --git a/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullEntity.java b/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullEntity.java index b593b25775..478d7e5c20 100644 --- a/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullEntity.java +++ b/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullEntity.java @@ -4,13 +4,15 @@ import java.util.List; import java.util.Map; +import org.jspecify.annotations.NonNull; + public class NonnullEntity { - @Nonnull - private final List<@Nonnull String> nonNullableField = new ArrayList<>(); + @NonNull + private final List<@NonNull String> nonNullableField = new ArrayList<>(); - @Nonnull + @NonNull public String nonNullableMethod( - @Nonnull Map nonNullableParameter) { + @NonNull Map nonNullableParameter) { return nonNullableParameter.getOrDefault("test", ""); } } diff --git a/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullParserTest.java b/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullParserTest.java index e2e077e8d6..b602a7948e 100644 --- a/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullParserTest.java +++ b/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullParserTest.java @@ -17,6 +17,7 @@ import static org.junit.Assert.assertTrue; public class NonnullParserTest { + private static final String ANNOTATION_NAME = "NonNull"; FieldDeclaration field; MethodDeclaration method; com.github.javaparser.ast.body.Parameter parameter; @@ -38,32 +39,33 @@ public void init() throws FileNotFoundException { @Test public void should_haveNonNullableField() { - assertTrue(field.isAnnotationPresent("Nonnull")); + assertTrue(field.isAnnotationPresent(ANNOTATION_NAME)); } @Test public void should_haveFieldWithNonNullableCollectionItem() { - assertTrue(field.getVariables().get(0).getType() - .asClassOrInterfaceType().getTypeArguments().get().get(0) - .getAnnotations().stream().anyMatch(annotation -> "Nonnull" - .equals(annotation.getName().asString()))); + assertTrue( + field.getVariables().get(0).getType().asClassOrInterfaceType() + .getTypeArguments().get().get(0).getAnnotations() + .stream().anyMatch(annotation -> ANNOTATION_NAME + .equals(annotation.getName().asString()))); } @Test public void should_haveMethodWithNonNullableReturnType() { - assertTrue(method.isAnnotationPresent("Nonnull")); + assertTrue(method.isAnnotationPresent(ANNOTATION_NAME)); } @Test public void should_haveMethodWithNonNullableParameter() { - assertTrue(parameter.isAnnotationPresent("Nonnull")); + assertTrue(parameter.isAnnotationPresent(ANNOTATION_NAME)); } @Test public void should_haveMethodParameterWithNonNullableCollectionItemType() { assertTrue(parameter.getType().asClassOrInterfaceType() .getTypeArguments().get().get(1).getAnnotations().stream() - .anyMatch(annotation -> "Nonnull" + .anyMatch(annotation -> ANNOTATION_NAME .equals(annotation.getName().asString()))); } } diff --git a/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullReflectionTest.java b/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullReflectionTest.java index fed280c5bc..794f1c0908 100644 --- a/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullReflectionTest.java +++ b/packages/java/endpoint/src/test/java/com/vaadin/hilla/NonnullReflectionTest.java @@ -7,6 +7,7 @@ import java.lang.reflect.Parameter; import java.util.Map; +import org.jspecify.annotations.NonNull; import org.junit.Before; import org.junit.Test; @@ -27,26 +28,26 @@ public void init() throws NoSuchFieldException, NoSuchMethodException { @Test public void should_haveNonNullableField() { - assertTrue(field.getAnnotatedType().isAnnotationPresent(Nonnull.class)); + assertTrue(field.getAnnotatedType().isAnnotationPresent(NonNull.class)); } @Test public void should_haveFieldWithNonNullableCollectionItem() { AnnotatedType listItemType = ((AnnotatedParameterizedType) field .getAnnotatedType()).getAnnotatedActualTypeArguments()[0]; - assertTrue(listItemType.isAnnotationPresent(Nonnull.class)); + assertTrue(listItemType.isAnnotationPresent(NonNull.class)); } @Test public void should_haveMethodWithNonNullableReturnType() { assertTrue(method.getAnnotatedReturnType() - .isAnnotationPresent(Nonnull.class)); + .isAnnotationPresent(NonNull.class)); } @Test public void should_haveMethodWithNonNullableParameter() { assertTrue(parameter.getAnnotatedType() - .isAnnotationPresent(Nonnull.class)); + .isAnnotationPresent(NonNull.class)); } @Test @@ -54,6 +55,6 @@ public void should_haveMethodParameterWithNonNullableCollectionItemType() { AnnotatedType mapValueType = ((AnnotatedParameterizedType) parameter .getAnnotatedType()).getAnnotatedActualTypeArguments()[1]; - assertTrue(mapValueType.isAnnotationPresent(Nonnull.class)); + assertTrue(mapValueType.isAnnotationPresent(NonNull.class)); } } diff --git a/packages/java/engine-core/pom.xml b/packages/java/engine-core/pom.xml index 2d0d752cd5..99e9b79240 100644 --- a/packages/java/engine-core/pom.xml +++ b/packages/java/engine-core/pom.xml @@ -49,8 +49,8 @@ ${project.version} - com.google.code.findbugs - jsr305 + org.jspecify + jspecify org.junit.jupiter diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorConfiguration.java index b15bb081c0..61e8cce213 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorConfiguration.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.engine; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -81,8 +81,8 @@ public Plugins() { disableAllDefaults = false; } - Plugins(@Nonnull Collection use, - @Nonnull Collection disable, + Plugins(@NonNull Collection use, + @NonNull Collection disable, boolean disableAllDefaults) { this.use.addAll(use); this.disable.addAll(disable); diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java index c05641df84..a045d07ec4 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java @@ -8,7 +8,7 @@ import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.engine.commandrunner.CommandNotFoundException; import com.vaadin.hilla.engine.commandrunner.CommandRunnerException; @@ -80,7 +80,7 @@ private GeneratorProcessor applyConfiguration( return this; } - private void applyPlugins(@Nonnull GeneratorConfiguration.Plugins plugins) { + private void applyPlugins(GeneratorConfiguration.@NonNull Plugins plugins) { pluginsProcessor.setConfig(plugins); } diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java index d0fd282829..fbe4ee86d1 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java @@ -6,7 +6,7 @@ import java.util.Objects; import java.util.Optional; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.PluginConfiguration; import com.vaadin.hilla.parser.plugins.backbone.BackbonePlugin; @@ -120,7 +120,7 @@ public PluginConfiguration getConfiguration() { return configuration; } - @Nonnull + @NonNull public String getName() { return name; } @@ -141,8 +141,8 @@ public Plugins() { disableAllDefaults = false; } - Plugins(@Nonnull Collection use, - @Nonnull Collection disable, + Plugins(@NonNull Collection use, + @NonNull Collection disable, boolean disableAllDefaults) { this.disable.addAll(disable); this.use.addAll(use); diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java index 8d5f09c0f4..c3cf28d256 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java @@ -10,7 +10,7 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -105,26 +105,26 @@ private void applyConfiguration(ParserConfiguration parserConfiguration) { } private void applyEndpointAnnotation( - @Nonnull String endpointAnnotationName) { + @NonNull String endpointAnnotationName) { this.endpointAnnotationName = Objects .requireNonNull(endpointAnnotationName); } private void applyEndpointExposedAnnotation( - @Nonnull String endpointExposedAnnotationName) { + @NonNull String endpointExposedAnnotationName) { this.endpointExposedAnnotationName = Objects .requireNonNull(endpointExposedAnnotationName); } - private void applyExposedPackages(@Nonnull List exposedPackages) { + private void applyExposedPackages(@NonNull List exposedPackages) { this.exposedPackages = exposedPackages; } - private void applyOpenAPIBase(@Nonnull String openAPIBasePath) { + private void applyOpenAPIBase(@NonNull String openAPIBasePath) { this.openAPIBasePath = openAPIBasePath; } - private void applyPlugins(@Nonnull ParserConfiguration.Plugins plugins) { + private void applyPlugins(ParserConfiguration.@NonNull Plugins plugins) { this.pluginsProcessor.setConfig(plugins); } diff --git a/packages/java/engine-runtime/pom.xml b/packages/java/engine-runtime/pom.xml index bf55ee4e30..4b82df65bd 100644 --- a/packages/java/engine-runtime/pom.xml +++ b/packages/java/engine-runtime/pom.xml @@ -39,8 +39,8 @@ ${project.version} - com.google.code.findbugs - jsr305 + org.jspecify + jspecify org.junit.jupiter diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index f91fdd6b7d..f91dff0062 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -15,7 +15,7 @@ */ package com.vaadin.hilla.internal; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import java.io.File; import java.net.URL; import java.util.Objects; @@ -66,7 +66,7 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator */ TaskGenerateOpenAPIImpl(File projectDirectory, String buildDirectoryName, File outputDirectory, Function resourceFinder, - @Nonnull ClassLoader classLoader, boolean isProductionMode) { + @NonNull ClassLoader classLoader, boolean isProductionMode) { super(projectDirectory, buildDirectoryName, outputDirectory, resourceFinder); this.classLoader = Objects.requireNonNull(classLoader, diff --git a/packages/java/gradle-plugin/src/functionalTest/kotlin/com/vaadin/hilla/gradle/plugin/SingleModuleTest.kt b/packages/java/gradle-plugin/src/functionalTest/kotlin/com/vaadin/hilla/gradle/plugin/SingleModuleTest.kt index 31abea1c87..61b5017fa3 100644 --- a/packages/java/gradle-plugin/src/functionalTest/kotlin/com/vaadin/hilla/gradle/plugin/SingleModuleTest.kt +++ b/packages/java/gradle-plugin/src/functionalTest/kotlin/com/vaadin/hilla/gradle/plugin/SingleModuleTest.kt @@ -131,14 +131,14 @@ class SingleModuleTest : AbstractGradleTest() { import com.vaadin.flow.server.auth.AnonymousAllowed; import com.vaadin.hilla.Endpoint; - import com.vaadin.hilla.Nonnull; + import org.jspecify.annotations.NonNull; @Endpoint @AnonymousAllowed public class HelloReactEndpoint { - @Nonnull - public String sayHello(@Nonnull String name) { + @NonNull + public String sayHello(@NonNull String name) { if (name.isEmpty()) { return "Hello stranger"; } else { diff --git a/packages/java/maven-plugin/pom.xml b/packages/java/maven-plugin/pom.xml index 9eea4a290b..8cecdf55d1 100644 --- a/packages/java/maven-plugin/pom.xml +++ b/packages/java/maven-plugin/pom.xml @@ -49,8 +49,8 @@ provided - com.google.code.findbugs - jsr305 + org.jspecify + jspecify com.vaadin diff --git a/packages/java/parser-jvm-core/pom.xml b/packages/java/parser-jvm-core/pom.xml index f2ff04f080..20e01828e8 100644 --- a/packages/java/parser-jvm-core/pom.xml +++ b/packages/java/parser-jvm-core/pom.xml @@ -20,8 +20,8 @@ - com.google.code.findbugs - jsr305 + org.jspecify + jspecify io.github.classgraph diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractCompositePlugin.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractCompositePlugin.java index 753af386db..19477347b8 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractCompositePlugin.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractCompositePlugin.java @@ -7,13 +7,13 @@ import com.vaadin.hilla.parser.utils.PluginException; -import jakarta.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public abstract class AbstractCompositePlugin extends AbstractPlugin { private final LinkedList plugins = new LinkedList<>(); - protected AbstractCompositePlugin(@Nonnull Plugin... plugins) { + protected AbstractCompositePlugin(@NonNull Plugin... plugins) { Stream.of(plugins).map(Objects::requireNonNull) .forEachOrdered(this.plugins::add); verifyPluginsOrder(); @@ -31,9 +31,9 @@ public void exit(NodePath nodePath) { } @Override - @Nonnull - public Node resolve(@Nonnull Node node, - @Nonnull NodePath parentPath) { + @NonNull + public Node resolve(@NonNull Node node, + @NonNull NodePath parentPath) { for (var plugin : plugins) { node = plugin.resolve(node, parentPath); } @@ -41,8 +41,8 @@ public void exit(NodePath nodePath) { } @Override - @Nonnull - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + @NonNull + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { for (var plugin : plugins) { nodeDependencies = plugin.scan(nodeDependencies); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractNode.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractNode.java index 21ac154f5c..68db4d4564 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractNode.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractNode.java @@ -2,7 +2,7 @@ import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.models.ClassInfoModel; import com.vaadin.hilla.parser.models.NamedModel; @@ -13,7 +13,7 @@ public abstract class AbstractNode implements Node { private T target; - protected AbstractNode(@Nonnull S source, T target) { + protected AbstractNode(@NonNull S source, T target) { this.source = Objects.requireNonNull(source); this.target = target; } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodeDependencies.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodeDependencies.java index c1c867f70e..6a4a0144e2 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodeDependencies.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodeDependencies.java @@ -4,31 +4,31 @@ import java.util.function.UnaryOperator; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public final class NodeDependencies { private final Stream> childNodes; private final Node node; private final Stream> relatedNodes; - NodeDependencies(@Nonnull Node node, - @Nonnull Stream> childNodes, - @Nonnull Stream> relatedNodes) { + NodeDependencies(@NonNull Node node, + @NonNull Stream> childNodes, + @NonNull Stream> relatedNodes) { this.node = Objects.requireNonNull(node); this.childNodes = Objects.requireNonNull(childNodes); this.relatedNodes = Objects.requireNonNull(relatedNodes); } - @Nonnull + @NonNull public NodeDependencies appendChildNodes( - @Nonnull Stream> childNodesToAppend) { + @NonNull Stream> childNodesToAppend) { return withChildNodes( Stream.concat(getChildNodes(), childNodesToAppend)); } - @Nonnull + @NonNull public NodeDependencies appendRelatedNodes( - @Nonnull Stream> relatedNodesToAppend) { + @NonNull Stream> relatedNodesToAppend) { return withRelatedNodes( Stream.concat(getRelatedNodes(), relatedNodesToAppend)); } @@ -45,43 +45,43 @@ public NodeDependencies appendRelatedNodes( return relatedNodes; } - @Nonnull + @NonNull public NodeDependencies prependChildNodes( - @Nonnull Stream> childNodesToPrepend) { + @NonNull Stream> childNodesToPrepend) { return withChildNodes( Stream.concat(childNodesToPrepend, getChildNodes())); } - @Nonnull + @NonNull public NodeDependencies prependRelatedNodes( - @Nonnull Stream> relatedNodesToPrepend) { + @NonNull Stream> relatedNodesToPrepend) { return withRelatedNodes( Stream.concat(relatedNodesToPrepend, getRelatedNodes())); } - @Nonnull + @NonNull public NodeDependencies processChildNodes( - @Nonnull UnaryOperator>> childNodesProcessor) { + @NonNull UnaryOperator>> childNodesProcessor) { return new NodeDependencies(getNode(), childNodesProcessor.apply(getChildNodes()), getRelatedNodes()); } - @Nonnull + @NonNull public NodeDependencies processRelatedNodes( - @Nonnull UnaryOperator>> relatedNodesProcessor) { + @NonNull UnaryOperator>> relatedNodesProcessor) { return new NodeDependencies(getNode(), getChildNodes(), relatedNodesProcessor.apply(getRelatedNodes())); } - @Nonnull + @NonNull private NodeDependencies withChildNodes( - @Nonnull Stream> childNodes) { + @NonNull Stream> childNodes) { return new NodeDependencies(getNode(), childNodes, getRelatedNodes()); } - @Nonnull + @NonNull private NodeDependencies withRelatedNodes( - @Nonnull Stream> relatedNodes) { + @NonNull Stream> relatedNodes) { return new NodeDependencies(getNode(), getChildNodes(), relatedNodes); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodePath.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodePath.java index 9aaae6d36e..b838695365 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodePath.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodePath.java @@ -4,21 +4,21 @@ import java.util.Objects; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public final class NodePath> { private final N node; private final NodePath parentPath; private final NodePath rootPath; - private NodePath(@Nonnull N node, @Nonnull NodePath parentPath) { + private NodePath(@NonNull N node, @NonNull NodePath parentPath) { this.node = Objects.requireNonNull(node); this.parentPath = Objects.requireNonNull(parentPath); this.rootPath = Objects.requireNonNull(parentPath.getRootPath()); } @SuppressWarnings("unchecked") - private NodePath(@Nonnull N node) { + private NodePath(@NonNull N node) { if (!(node instanceof RootNode)) { throw new IllegalArgumentException("RootNode instance required"); } @@ -27,7 +27,7 @@ private NodePath(@Nonnull N node) { this.rootPath = (NodePath) this; } - static NodePath forRoot(@Nonnull RootNode rootNode) { + static NodePath forRoot(@NonNull RootNode rootNode) { return new NodePath<>(rootNode); } @@ -100,7 +100,7 @@ public String toString() { return String.join("", list); } - > NodePath withChildNode(@Nonnull N node) { + > NodePath withChildNode(@NonNull N node) { return new NodePath<>(node, this); } } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java index abe5348fc1..7251554883 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java @@ -14,7 +14,7 @@ import java.util.function.Consumer; import java.util.stream.Collectors; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.ClassInfo; import org.slf4j.Logger; @@ -62,8 +62,8 @@ public Parser() { } } - private static OpenAPI parseOpenAPIFile(@Nonnull String source, - @Nonnull OpenAPIFileType type, OpenAPI origin) { + private static OpenAPI parseOpenAPIFile(@NonNull String source, + @NonNull OpenAPIFileType type, OpenAPI origin) { try { var mapper = type.getMapper(); var reader = origin != null ? mapper.readerForUpdating(origin) @@ -86,8 +86,8 @@ private static OpenAPI parseOpenAPIFile(@Nonnull String source, * An instance of the parser plugin. * @return this (for method chaining). */ - @Nonnull - public Parser addPlugin(@Nonnull Plugin plugin) { + @NonNull + public Parser addPlugin(@NonNull Plugin plugin) { config.plugins.add(Objects.requireNonNull(plugin)); return this; } @@ -99,8 +99,8 @@ public Parser addPlugin(@Nonnull Plugin plugin) { * a consumer lambda that accepts an OpenAPI instance. * @return this (for method chaining). */ - @Nonnull - public Parser adjustOpenAPI(@Nonnull Consumer action) { + @NonNull + public Parser adjustOpenAPI(@NonNull Consumer action) { action.accept(config.openAPI); return this; } @@ -113,8 +113,8 @@ public Parser adjustOpenAPI(@Nonnull Consumer action) { * * @return this (for method chaining). */ - @Nonnull - public Parser classLoader(@Nonnull ClassLoader classLoader) { + @NonNull + public Parser classLoader(@NonNull ClassLoader classLoader) { config.classLoader = classLoader; return this; } @@ -130,8 +130,8 @@ public Parser classLoader(@Nonnull ClassLoader classLoader) { * a list of paths forming the classpath. * @return this (for method chaining). */ - @Nonnull - public Parser classPath(@Nonnull String... classPathElements) { + @NonNull + public Parser classPath(@NonNull String... classPathElements) { return classPath(classPathElements, true); } @@ -146,8 +146,8 @@ public Parser classPath(@Nonnull String... classPathElements) { * already specified. * @return this (for method chaining). */ - @Nonnull - public Parser classPath(@Nonnull String[] classPathElements, + @NonNull + public Parser classPath(@NonNull String[] classPathElements, boolean override) { return classPath( Arrays.asList(Objects.requireNonNull(classPathElements)), @@ -165,8 +165,8 @@ public Parser classPath(@Nonnull String[] classPathElements, * a list of paths forming the classpath. * @return this (for method chaining). */ - @Nonnull - public Parser classPath(@Nonnull Collection classPathElements) { + @NonNull + public Parser classPath(@NonNull Collection classPathElements) { return classPath(classPathElements, true); } @@ -181,8 +181,8 @@ public Parser classPath(@Nonnull Collection classPathElements) { * already specified. * @return this (for method chaining). */ - @Nonnull - public Parser classPath(@Nonnull Collection classPathElements, + @NonNull + public Parser classPath(@NonNull Collection classPathElements, boolean override) { if (override || config.classPathElements == null) { config.classPathElements = new HashSet<>( @@ -203,9 +203,9 @@ public Parser classPath(@Nonnull Collection classPathElements, * The fully qualified name of the annotation * @return this (for method chaining). */ - @Nonnull + @NonNull public Parser endpointAnnotation( - @Nonnull String annotationFullyQualifiedName) { + @NonNull String annotationFullyQualifiedName) { return endpointAnnotation(annotationFullyQualifiedName, true); } @@ -221,9 +221,9 @@ public Parser endpointAnnotation( * it is already specified. * @return this (for method chaining). */ - @Nonnull + @NonNull public Parser endpointAnnotation( - @Nonnull String annotationFullyQualifiedName, boolean override) { + @NonNull String annotationFullyQualifiedName, boolean override) { if (override || config.endpointAnnotationName == null) { config.endpointAnnotationName = Objects .requireNonNull(annotationFullyQualifiedName); @@ -244,9 +244,9 @@ public Parser endpointAnnotation( * The fully qualified name of the annotation * @return this (for method chaining). */ - @Nonnull + @NonNull public Parser endpointExposedAnnotation( - @Nonnull String annotationFullyQualifiedName) { + @NonNull String annotationFullyQualifiedName) { return endpointExposedAnnotation(annotationFullyQualifiedName, true); } @@ -263,9 +263,9 @@ public Parser endpointExposedAnnotation( * it is already specified. * @return this (for method chaining). */ - @Nonnull + @NonNull public Parser endpointExposedAnnotation( - @Nonnull String annotationFullyQualifiedName, boolean override) { + @NonNull String annotationFullyQualifiedName, boolean override) { if (override || config.endpointExposedAnnotationName == null) { config.endpointExposedAnnotationName = Objects .requireNonNull(annotationFullyQualifiedName); @@ -273,13 +273,13 @@ public Parser endpointExposedAnnotation( return this; } - @Nonnull - public Parser exposedPackages(@Nonnull Collection exposedPackages) { + @NonNull + public Parser exposedPackages(@NonNull Collection exposedPackages) { return exposedPackages(exposedPackages, true); } - @Nonnull - public Parser exposedPackages(@Nonnull Collection exposedPackages, + @NonNull + public Parser exposedPackages(@NonNull Collection exposedPackages, boolean override) { if (override || config.exposedPackages == null) { config.exposedPackages = Objects.requireNonNull(exposedPackages); @@ -292,7 +292,7 @@ public Parser exposedPackages(@Nonnull Collection exposedPackages, * * @return A result OpenAPI object. */ - @Nonnull + @NonNull public OpenAPI execute() { Objects.requireNonNull(config.classLoader, "[JVM Parser] classLoader is not provided."); @@ -390,7 +390,7 @@ private void throwIfAnnotationIsAclAnnotation(String annotationName, * * @return configuration object. */ - @Nonnull + @NonNull public Config getConfig() { return config; } @@ -414,9 +414,9 @@ public Config getConfig() { * The parser for the OpenAPI definition * @return this (for method chaining). */ - @Nonnull - public Parser openAPISource(@Nonnull String source, - @Nonnull OpenAPIFileType type) { + @NonNull + public Parser openAPISource(@NonNull String source, + @NonNull OpenAPIFileType type) { config.openAPI = parseOpenAPIFile(Objects.requireNonNull(source), Objects.requireNonNull(type), config.openAPI); @@ -435,8 +435,8 @@ public Parser openAPISource(@Nonnull String source, * a collection of parser plugins. * @return this (for method chaining). */ - @Nonnull - public Parser plugins(@Nonnull Plugin... plugins) { + @NonNull + public Parser plugins(@NonNull Plugin... plugins) { return plugins(Arrays.asList(plugins)); } @@ -451,8 +451,8 @@ public Parser plugins(@Nonnull Plugin... plugins) { * a collection of parser plugins. * @return this (for method chaining). */ - @Nonnull - public Parser plugins(@Nonnull Collection plugins) { + @NonNull + public Parser plugins(@NonNull Collection plugins) { config.plugins.clear(); config.plugins.addAll(Objects.requireNonNull(plugins)); return this; @@ -480,7 +480,7 @@ private Config(OpenAPI openAPI) { * * @return the class loader */ - @Nonnull + @NonNull public ClassLoader getClassLoader() { return classLoader; } @@ -490,7 +490,7 @@ public ClassLoader getClassLoader() { * * @return the collection of classpath elements. */ - @Nonnull + @NonNull public Set getClassPathElements() { return classPathElements; } @@ -500,7 +500,7 @@ public Set getClassPathElements() { * * @return the annotation name. */ - @Nonnull + @NonNull public String getEndpointAnnotationName() { return endpointAnnotationName; } @@ -510,12 +510,12 @@ public String getEndpointAnnotationName() { * * @return the annotation name. */ - @Nonnull + @NonNull public String getEndpointExposedAnnotationName() { return endpointExposedAnnotationName; } - @Nonnull + @NonNull public Collection getExposedPackages() { return exposedPackages; } @@ -528,7 +528,7 @@ public Collection getExposedPackages() { * * @return OpenAPI object. */ - @Nonnull + @NonNull public OpenAPI getOpenAPI() { return openAPI; } @@ -538,7 +538,7 @@ public OpenAPI getOpenAPI() { * * @return the collection of parser plugins. */ - @Nonnull + @NonNull public Collection getPlugins() { return plugins; } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Plugin.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Plugin.java index 81c5ed933f..3fbf77d5a6 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Plugin.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Plugin.java @@ -3,7 +3,7 @@ import java.util.Collection; import java.util.Collections; -import jakarta.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public interface Plugin { @@ -19,14 +19,14 @@ default Collection> getRequiredPlugins() { return Collections.emptyList(); } - @Nonnull - default Node resolve(@Nonnull Node node, - @Nonnull NodePath parentPath) { + @NonNull + default Node resolve(@NonNull Node node, + @NonNull NodePath parentPath) { return node; } - @Nonnull - NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies); + @NonNull + NodeDependencies scan(@NonNull NodeDependencies nodeDependencies); void setStorage(SharedStorage storage); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/PluginExecutor.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/PluginExecutor.java index fa7440d788..3380d6e89f 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/PluginExecutor.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/PluginExecutor.java @@ -11,7 +11,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,7 +25,7 @@ public final class PluginExecutor { private final RootNode rootNode; private final Map, NodeScanResult> scanResults = new HashMap<>(); - public PluginExecutor(@Nonnull Plugin plugin, @Nonnull RootNode rootNode) { + public PluginExecutor(@NonNull Plugin plugin, @NonNull RootNode rootNode) { this.plugin = Objects.requireNonNull(plugin); this.rootNode = Objects.requireNonNull(rootNode); } @@ -62,7 +62,7 @@ private void enqueueExitFirst(NodePath path) { queue.addFirst(new ExitTask(path)); } - @Nonnull + @NonNull private NodeScanResult scanNodeDependencies(Node node) { return scanResults.computeIfAbsent(node, n -> new NodeScanResult(plugin.scan(new NodeDependencies(n, @@ -70,7 +70,7 @@ private NodeScanResult scanNodeDependencies(Node node) { } private class EnterTask extends Task { - public EnterTask(@Nonnull NodePath path) { + public EnterTask(@NonNull NodePath path) { super(path); } @@ -96,7 +96,7 @@ void execute() { } private class ExitTask extends Task { - public ExitTask(@Nonnull NodePath path) { + public ExitTask(@NonNull NodePath path) { super(path); } @@ -110,7 +110,7 @@ private static class NodeScanResult { private final Node node; private final List> relatedNodes; - public NodeScanResult(@Nonnull NodeDependencies nodeDependencies) { + public NodeScanResult(@NonNull NodeDependencies nodeDependencies) { Objects.requireNonNull(nodeDependencies); this.node = nodeDependencies.getNode(); this.childNodes = nodeDependencies.getChildNodes() @@ -119,17 +119,17 @@ public NodeScanResult(@Nonnull NodeDependencies nodeDependencies) { .collect(Collectors.toList()); } - @Nonnull + @NonNull public List> getChildNodes() { return childNodes; } - @Nonnull + @NonNull public Node getNode() { return node; } - @Nonnull + @NonNull public List> getRelatedNodes() { return relatedNodes; } @@ -138,7 +138,7 @@ public NodeScanResult(@Nonnull NodeDependencies nodeDependencies) { private static abstract class Task { private final NodePath path; - public Task(@Nonnull NodePath path) { + public Task(@NonNull NodePath path) { this.path = Objects.requireNonNull(path); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java index 1876b6ee3d..990b6a2e70 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java @@ -1,11 +1,11 @@ package com.vaadin.hilla.parser.core; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.swagger.v3.oas.models.OpenAPI; public final class RootNode extends AbstractNode { - RootNode(@Nonnull ScanResult source, @Nonnull OpenAPI target) { + RootNode(@NonNull ScanResult source, @NonNull OpenAPI target) { super(source, target); } } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotatedAbstractModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotatedAbstractModel.java index fdd1e50463..d54399bdf3 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotatedAbstractModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotatedAbstractModel.java @@ -6,7 +6,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.AnnotationInfo; @@ -14,7 +14,7 @@ public abstract class AnnotatedAbstractModel implements AnnotatedModel { private List annotations; protected static List processAnnotations( - @Nonnull Annotation[] annotations) { + @NonNull Annotation[] annotations) { return Arrays.stream(annotations).map(AnnotationInfoModel::of) .collect(Collectors.toList()); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationInfoModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationInfoModel.java index 0f505c9bdb..5cc227f85b 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationInfoModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationInfoModel.java @@ -5,7 +5,7 @@ import java.util.Optional; import java.util.Set; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.AnnotationInfo; @@ -14,11 +14,11 @@ public abstract class AnnotationInfoModel implements Model, NamedModel { private Set parameters; @Deprecated - public static AnnotationInfoModel of(@Nonnull AnnotationInfo origin) { + public static AnnotationInfoModel of(@NonNull AnnotationInfo origin) { return new AnnotationInfoSourceModel(Objects.requireNonNull(origin)); } - public static AnnotationInfoModel of(@Nonnull Annotation origin) { + public static AnnotationInfoModel of(@NonNull Annotation origin) { return new AnnotationInfoReflectionModel( Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterEnumValueModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterEnumValueModel.java index 7cb2c3a965..44a579bf35 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterEnumValueModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterEnumValueModel.java @@ -2,7 +2,7 @@ import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.AnnotationEnumValue; @@ -11,13 +11,13 @@ public abstract class AnnotationParameterEnumValueModel implements Model { @Deprecated public static AnnotationParameterEnumValueModel of( - @Nonnull AnnotationEnumValue origin) { + @NonNull AnnotationEnumValue origin) { return new AnnotationParameterEnumValueSourceModel( Objects.requireNonNull(origin)); } public static AnnotationParameterEnumValueModel of( - @Nonnull Enum origin) { + @NonNull Enum origin) { return new AnnotationParameterEnumValueReflectionModel( Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterModel.java index 295ba112f8..0c30e297b1 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterModel.java @@ -2,28 +2,28 @@ import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.AnnotationParameterValue; public abstract class AnnotationParameterModel implements Model, NamedModel { private Object value; - public static AnnotationParameterModel of(@Nonnull String name, - @Nonnull Object value, boolean isDefault) { + public static AnnotationParameterModel of(@NonNull String name, + @NonNull Object value, boolean isDefault) { return of(new ReflectionOrigin<>(Objects.requireNonNull(name), Objects.requireNonNull(value), isDefault)); } public static AnnotationParameterModel of( - @Nonnull ReflectionOrigin origin) { + @NonNull ReflectionOrigin origin) { return new AnnotationParameterReflectionModel<>( Objects.requireNonNull(origin)); } @Deprecated public static AnnotationParameterModel of( - @Nonnull AnnotationParameterValue origin) { + @NonNull AnnotationParameterValue origin) { return new AnnotationParameterSourceModel( Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ArraySignatureModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ArraySignatureModel.java index 7ba50abf6c..f373eca272 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ArraySignatureModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ArraySignatureModel.java @@ -3,7 +3,7 @@ import java.lang.reflect.AnnotatedArrayType; import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.ArrayTypeSignature; @@ -12,11 +12,11 @@ public abstract class ArraySignatureModel extends AnnotatedAbstractModel private SignatureModel nestedType; @Deprecated - public static ArraySignatureModel of(@Nonnull ArrayTypeSignature origin) { + public static ArraySignatureModel of(@NonNull ArrayTypeSignature origin) { return new ArraySignatureSourceModel(Objects.requireNonNull(origin)); } - public static ArraySignatureModel of(@Nonnull AnnotatedArrayType origin) { + public static ArraySignatureModel of(@NonNull AnnotatedArrayType origin) { return new ArraySignatureReflectionModel( Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/BaseSignatureModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/BaseSignatureModel.java index f8c09c8ecb..580b0c2c5f 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/BaseSignatureModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/BaseSignatureModel.java @@ -3,22 +3,22 @@ import java.lang.reflect.AnnotatedType; import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.BaseTypeSignature; public abstract class BaseSignatureModel extends AnnotatedAbstractModel implements SignatureModel { @Deprecated - public static BaseSignatureModel of(@Nonnull BaseTypeSignature origin) { + public static BaseSignatureModel of(@NonNull BaseTypeSignature origin) { return new BaseSignatureSourceModel(Objects.requireNonNull(origin)); } - public static BaseSignatureModel of(@Nonnull AnnotatedType origin) { + public static BaseSignatureModel of(@NonNull AnnotatedType origin) { return new BaseSignatureReflectionModel(Objects.requireNonNull(origin)); } - public static BaseSignatureModel of(@Nonnull Class origin) { + public static BaseSignatureModel of(@NonNull Class origin) { return new BaseSignatureReflectionModel.Bare( Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassInfoModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassInfoModel.java index 7ee5da1898..3df04af3dd 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassInfoModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassInfoModel.java @@ -17,7 +17,7 @@ import java.util.Optional; import java.util.function.BiPredicate; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.ClassInfo; @@ -209,11 +209,11 @@ public static boolean isNonJDKClass(AnnotatedType cls) { } @Deprecated - public static ClassInfoModel of(@Nonnull ClassInfo origin) { + public static ClassInfoModel of(@NonNull ClassInfo origin) { return new ClassInfoSourceModel(Objects.requireNonNull(origin)); } - public static ClassInfoModel of(@Nonnull Class origin) { + public static ClassInfoModel of(@NonNull Class origin) { return new ClassInfoReflectionModel(Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureArtificialModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureArtificialModel.java index d992e54246..546e966f4e 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureArtificialModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureArtificialModel.java @@ -4,7 +4,7 @@ import java.util.Objects; import java.util.Optional; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; /** * An artificial ClassRefSignatureModel implementation. @@ -14,9 +14,9 @@ final class ClassRefSignatureArtificialModel extends ClassRefSignatureModel { private final ClassInfoModel classInfo; private final List typeArguments; - ClassRefSignatureArtificialModel(@Nonnull ClassInfoModel classInfo, - @Nonnull List typeArguments, - @Nonnull List annotations) { + ClassRefSignatureArtificialModel(@NonNull ClassInfoModel classInfo, + @NonNull List typeArguments, + @NonNull List annotations) { this.classInfo = Objects.requireNonNull(classInfo); this.typeArguments = Objects.requireNonNull(typeArguments); this.annotations = Objects.requireNonNull(annotations); diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureModel.java index 093cc69d27..88f340036a 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureModel.java @@ -7,7 +7,7 @@ import java.util.Objects; import java.util.Optional; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.ClassInfo; import io.github.classgraph.ClassRefTypeSignature; @@ -80,18 +80,18 @@ public static boolean is(ClassRefTypeSignature actor, String target) { @Deprecated public static ClassRefSignatureModel of( - @Nonnull ClassRefTypeSignature origin) { + @NonNull ClassRefTypeSignature origin) { return Objects.requireNonNull(origin).getSuffixes().size() > 0 ? new ClassRefSignatureSourceModel.Suffixed(origin) : new ClassRefSignatureSourceModel.Regular(origin); } - public static ClassRefSignatureModel of(@Nonnull Class origin) { + public static ClassRefSignatureModel of(@NonNull Class origin) { return new ClassRefSignatureReflectionModel.Bare( Objects.requireNonNull(origin)); } - public static ClassRefSignatureModel of(@Nonnull AnnotatedType origin) { + public static ClassRefSignatureModel of(@NonNull AnnotatedType origin) { return ClassRefSignatureReflectionModel.Annotated .of(Objects.requireNonNull(origin)); } @@ -110,9 +110,9 @@ public static ClassRefSignatureModel of(@Nonnull AnnotatedType origin) { * @deprecated */ @Deprecated - public static ClassRefSignatureModel of(@Nonnull ClassInfoModel classInfo, - @Nonnull List typeArguments, - @Nonnull List annotations) { + public static ClassRefSignatureModel of(@NonNull ClassInfoModel classInfo, + @NonNull List typeArguments, + @NonNull List annotations) { return new ClassRefSignatureArtificialModel(classInfo, typeArguments, annotations); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/FieldInfoModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/FieldInfoModel.java index 4234421554..e3f3dc8646 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/FieldInfoModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/FieldInfoModel.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.models; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import java.lang.reflect.Field; import java.util.Objects; @@ -13,11 +13,11 @@ public abstract class FieldInfoModel extends AnnotatedAbstractModel private SignatureModel type; @Deprecated - public static FieldInfoModel of(@Nonnull FieldInfo origin) { + public static FieldInfoModel of(@NonNull FieldInfo origin) { return new FieldInfoSourceModel(Objects.requireNonNull(origin)); } - public static FieldInfoModel of(@Nonnull Field origin) { + public static FieldInfoModel of(@NonNull Field origin) { return new FieldInfoReflectionModel(Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodInfoModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodInfoModel.java index 93fb59bc0d..10f8e75af6 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodInfoModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodInfoModel.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.MethodInfo; @@ -21,11 +21,11 @@ public abstract class MethodInfoModel extends AnnotatedAbstractModel private List typeParameters; @Deprecated - public static MethodInfoModel of(@Nonnull MethodInfo origin) { + public static MethodInfoModel of(@NonNull MethodInfo origin) { return new MethodInfoSourceModel(Objects.requireNonNull(origin)); } - public static MethodInfoModel of(@Nonnull Executable origin) { + public static MethodInfoModel of(@NonNull Executable origin) { return Objects.requireNonNull(origin) instanceof Constructor ? new MethodInfoReflectionModel.Constructor( (Constructor) origin) diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodParameterInfoModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodParameterInfoModel.java index 39163533d2..90401c0d8f 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodParameterInfoModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodParameterInfoModel.java @@ -3,7 +3,7 @@ import java.lang.reflect.Parameter; import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.MethodParameterInfo; @@ -15,12 +15,12 @@ public abstract class MethodParameterInfoModel extends AnnotatedAbstractModel @Deprecated public static MethodParameterInfoModel of( - @Nonnull MethodParameterInfo origin) { + @NonNull MethodParameterInfo origin) { return new MethodParameterInfoSourceModel( Objects.requireNonNull(origin)); } - public static MethodParameterInfoModel of(@Nonnull Parameter origin) { + public static MethodParameterInfoModel of(@NonNull Parameter origin) { return new MethodParameterInfoReflectionModel( Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/SignatureModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/SignatureModel.java index e6459997a5..b39f7dafe8 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/SignatureModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/SignatureModel.java @@ -8,7 +8,7 @@ import java.lang.reflect.AnnotatedWildcardType; import java.lang.reflect.TypeVariable; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.ArrayTypeSignature; import io.github.classgraph.BaseTypeSignature; @@ -21,7 +21,7 @@ public interface SignatureModel extends Model, SpecializedModel, AnnotatedModel { @Deprecated - static SignatureModel of(@Nonnull HierarchicalTypeSignature signature) { + static SignatureModel of(@NonNull HierarchicalTypeSignature signature) { if (signature instanceof BaseTypeSignature) { return BaseSignatureModel.of((BaseTypeSignature) signature); } else if (signature instanceof ArrayTypeSignature) { @@ -37,7 +37,7 @@ static SignatureModel of(@Nonnull HierarchicalTypeSignature signature) { } } - static SignatureModel of(@Nonnull AnnotatedElement signature) { + static SignatureModel of(@NonNull AnnotatedElement signature) { if (signature instanceof AnnotatedParameterizedType) { return ClassRefSignatureModel .of((AnnotatedParameterizedType) signature); diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeArgumentModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeArgumentModel.java index 4dd4f78bd0..d307c98475 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeArgumentModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeArgumentModel.java @@ -4,7 +4,7 @@ import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.TypeArgument; @@ -13,11 +13,11 @@ public abstract class TypeArgumentModel extends AnnotatedAbstractModel private List associatedTypes; @Deprecated - public static TypeArgumentModel of(@Nonnull TypeArgument origin) { + public static TypeArgumentModel of(@NonNull TypeArgument origin) { return new TypeArgumentSourceModel(Objects.requireNonNull(origin)); } - public static TypeArgumentModel of(@Nonnull AnnotatedType origin) { + public static TypeArgumentModel of(@NonNull AnnotatedType origin) { return new TypeArgumentReflectionModel(Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterModel.java index ea6bca9d29..81c512000d 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterModel.java @@ -4,7 +4,7 @@ import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.TypeParameter; @@ -13,11 +13,11 @@ public abstract class TypeParameterModel extends AnnotatedAbstractModel private List bounds; @Deprecated - public static TypeParameterModel of(@Nonnull TypeParameter origin) { + public static TypeParameterModel of(@NonNull TypeParameter origin) { return new TypeParameterSourceModel(Objects.requireNonNull(origin)); } - public static TypeParameterModel of(@Nonnull TypeVariable origin) { + public static TypeParameterModel of(@NonNull TypeVariable origin) { return new TypeParameterReflectionModel(Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterSourceModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterSourceModel.java index 46dfbfe5f7..69690a6136 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterSourceModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterSourceModel.java @@ -4,7 +4,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.utils.Streams; @@ -45,7 +45,7 @@ protected List prepareBounds() { .distinct().collect(Collectors.toList()); } - @Nonnull + @NonNull private SignatureModel getClassBoundSignature() { // FIXME: param class bound is sometimes null and sometimes Object. // Possibly a bug in ClassGraph. Use Object to align with reflection. diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeVariableModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeVariableModel.java index 84934d90cc..f2ae6b48d1 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeVariableModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeVariableModel.java @@ -3,7 +3,7 @@ import java.lang.reflect.AnnotatedTypeVariable; import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import io.github.classgraph.TypeVariableSignature; @@ -12,11 +12,11 @@ public abstract class TypeVariableModel extends AnnotatedAbstractModel private TypeParameterModel typeParameter; @Deprecated - public static TypeVariableModel of(@Nonnull TypeVariableSignature origin) { + public static TypeVariableModel of(@NonNull TypeVariableSignature origin) { return new TypeVariableSourceModel(Objects.requireNonNull(origin)); } - public static TypeVariableModel of(@Nonnull AnnotatedTypeVariable origin) { + public static TypeVariableModel of(@NonNull AnnotatedTypeVariable origin) { return new TypeVariableReflectionModel(Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/jackson/JacksonPropertyModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/jackson/JacksonPropertyModel.java index d1bceaa401..0614c5812c 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/jackson/JacksonPropertyModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/jackson/JacksonPropertyModel.java @@ -21,7 +21,7 @@ import com.vaadin.hilla.parser.models.ReflectionModel; import com.vaadin.hilla.parser.models.SignatureModel; -import jakarta.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public final class JacksonPropertyModel extends JacksonModel @@ -39,7 +39,7 @@ private JacksonPropertyModel(BeanPropertyDefinition origin) { } public static JacksonPropertyModel of( - @Nonnull BeanPropertyDefinition origin) { + @NonNull BeanPropertyDefinition origin) { return new JacksonPropertyModel(Objects.requireNonNull(origin)); } diff --git a/packages/java/parser-jvm-core/src/main/java/module-info.java b/packages/java/parser-jvm-core/src/main/java/module-info.java index f8dc6003fb..acf1f5276b 100644 --- a/packages/java/parser-jvm-core/src/main/java/module-info.java +++ b/packages/java/parser-jvm-core/src/main/java/module-info.java @@ -5,7 +5,7 @@ requires io.github.classgraph; requires io.swagger.v3.core; requires io.swagger.v3.oas.models; - requires jsr305; + requires org.jspecify; requires jakarta.annotation; requires org.slf4j; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java index 71573d7f1a..88554ae63d 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java @@ -13,7 +13,7 @@ import java.util.Set; import java.util.function.Consumer; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -194,10 +194,10 @@ public void enter(NodePath nodePath) { public void exit(NodePath nodePath) { } - @Nonnull + @NonNull @Override public NodeDependencies scan( - @Nonnull NodeDependencies nodeDependencies) { + @NonNull NodeDependencies nodeDependencies) { return nodeDependencies; } } @@ -214,10 +214,10 @@ public void enter(NodePath nodePath) { public void exit(NodePath nodePath) { } - @Nonnull + @NonNull @Override public NodeDependencies scan( - @Nonnull NodeDependencies nodeDependencies) { + @NonNull NodeDependencies nodeDependencies) { return nodeDependencies; } } @@ -237,10 +237,10 @@ public void enter(NodePath nodePath) { public void exit(NodePath nodePath) { } - @Nonnull + @NonNull @Override public NodeDependencies scan( - @Nonnull NodeDependencies nodeDependencies) { + @NonNull NodeDependencies nodeDependencies) { return nodeDependencies; } } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java index c649827b36..55b3bc3ca3 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java @@ -7,7 +7,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; @@ -30,9 +30,9 @@ public void enter(NodePath nodePath) { public void exit(NodePath nodePath) { } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { var node = nodeDependencies.getNode(); if (node instanceof RootNode) { var rootNode = (RootNode) node; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/FinalizePlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/FinalizePlugin.java index fdde4dece3..b764fd4b06 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/FinalizePlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/FinalizePlugin.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; @@ -45,9 +45,9 @@ public void exit(NodePath nodePath) { } } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { return nodeDependencies; } } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/RemovePlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/RemovePlugin.java index a943bb893d..c3d0afca11 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/RemovePlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/RemovePlugin.java @@ -2,7 +2,7 @@ import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.Node; @@ -22,9 +22,9 @@ public void exit(NodePath nodePath) { } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { return nodeDependencies.processRelatedNodes(this::removeBazEntity); } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/ReplacePlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/ReplacePlugin.java index 9406c94491..60dceda0cd 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/ReplacePlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/ReplacePlugin.java @@ -2,7 +2,7 @@ import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.Node; @@ -25,9 +25,9 @@ public void exit(NodePath nodePath) { } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { var node = nodeDependencies.getNode(); if (node instanceof EndpointNode) { return nodeDependencies.processChildNodes(this::removeBarMethod) @@ -37,7 +37,7 @@ public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { } } - @Nonnull + @NonNull private Stream> getReplacementFields() { try { return Stream @@ -49,9 +49,9 @@ public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { } } - @Nonnull + @NonNull private Stream> removeBarMethod( - @Nonnull Stream> nodes) { + @NonNull Stream> nodes) { return nodes.filter(node -> !((node instanceof MethodNode) && ((MethodNode) node).getSource().getName().equals("bar"))); } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityThree.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityThree.java index 67db62038b..e53d14edd3 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityThree.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityThree.java @@ -1,11 +1,11 @@ package com.vaadin.hilla.parser.core.dependency; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public class DependencyEntityThree { private String foo3 = "foo3"; - @Nonnull + @NonNull public String getFoo3() { return foo3; } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityTwo.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityTwo.java index 8573d29bcc..daa03fb196 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityTwo.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityTwo.java @@ -1,11 +1,11 @@ package com.vaadin.hilla.parser.core.dependency; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public class DependencyEntityTwo { public DependencyEntityOne foo2; - @Nonnull + @NonNull public DependencyEntityOne circular() { return foo2; } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java index 5836b55ed1..003196270e 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java @@ -7,7 +7,7 @@ import java.util.Optional; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; @@ -63,9 +63,9 @@ public void exit(NodePath nodePath) { } } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { var node = nodeDependencies.getNode(); if (node instanceof RootNode) { var rootNode = (RootNode) node; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/PluginDependencyEntity.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/PluginDependencyEntity.java index a1b047d1af..bd4200b5c0 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/PluginDependencyEntity.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/PluginDependencyEntity.java @@ -1,11 +1,11 @@ package com.vaadin.hilla.parser.core.dependency; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public class PluginDependencyEntity { private String pluginDependencyField = "foo"; - @Nonnull + @NonNull public String getPluginDependencyField() { return pluginDependencyField; } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EndpointNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EndpointNode.java index 8dc02a8524..53c81a0a4e 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EndpointNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EndpointNode.java @@ -1,18 +1,18 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; import io.swagger.v3.oas.models.tags.Tag; public final class EndpointNode extends AbstractNode { - private EndpointNode(@Nonnull ClassInfoModel value, @Nonnull Tag schema) { + private EndpointNode(@NonNull ClassInfoModel value, @NonNull Tag schema) { super(value, schema); } - @Nonnull - public static EndpointNode of(@Nonnull ClassInfoModel cls) { + @NonNull + public static EndpointNode of(@NonNull ClassInfoModel cls) { return new EndpointNode(cls, new Tag()); } } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EntityNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EntityNode.java index bfc2fd8643..8052ff74b9 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EntityNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EntityNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; @@ -8,13 +8,13 @@ import io.swagger.v3.oas.models.media.Schema; public final class EntityNode extends AbstractNode> { - private EntityNode(@Nonnull ClassInfoModel source, - @Nonnull ObjectSchema target) { + private EntityNode(@NonNull ClassInfoModel source, + @NonNull ObjectSchema target) { super(source, target); } - @Nonnull - static public EntityNode of(@Nonnull ClassInfoModel model) { + @NonNull + static public EntityNode of(@NonNull ClassInfoModel model) { return new EntityNode(model, new ObjectSchema()); } } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/FieldNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/FieldNode.java index 7749238439..111074866b 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/FieldNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/FieldNode.java @@ -1,17 +1,17 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.FieldInfoModel; public final class FieldNode extends AbstractNode { - private FieldNode(@Nonnull FieldInfoModel source, @Nonnull String target) { + private FieldNode(@NonNull FieldInfoModel source, @NonNull String target) { super(source, target); } - @Nonnull - static public FieldNode of(@Nonnull FieldInfoModel source) { + @NonNull + static public FieldNode of(@NonNull FieldInfoModel source) { return new FieldNode(source, ""); } } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodNode.java index 57b2d67785..be51d3fe4c 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodNode.java @@ -1,19 +1,19 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.MethodInfoModel; import io.swagger.v3.oas.models.PathItem; public final class MethodNode extends AbstractNode { - private MethodNode(@Nonnull MethodInfoModel source, - @Nonnull PathItem target) { + private MethodNode(@NonNull MethodInfoModel source, + @NonNull PathItem target) { super(source, target); } - @Nonnull - static public MethodNode of(@Nonnull MethodInfoModel model) { + @NonNull + static public MethodNode of(@NonNull MethodInfoModel model) { return new MethodNode(model, new PathItem()); } } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodParameterNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodParameterNode.java index f38aef4203..e77220733d 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodParameterNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodParameterNode.java @@ -1,20 +1,20 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.MethodParameterInfoModel; public final class MethodParameterNode extends AbstractNode { - private MethodParameterNode(@Nonnull MethodParameterInfoModel source, + private MethodParameterNode(@NonNull MethodParameterInfoModel source, String target) { super(source, target); } - @Nonnull + @NonNull static public MethodParameterNode of( - @Nonnull MethodParameterInfoModel source, @Nonnull String target) { + @NonNull MethodParameterInfoModel source, @NonNull String target) { return new MethodParameterNode(source, target); } } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/TypeSignatureNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/TypeSignatureNode.java index a978428bf0..7564174639 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/TypeSignatureNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/TypeSignatureNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.SignatureModel; @@ -8,13 +8,13 @@ public final class TypeSignatureNode extends AbstractNode> { - private TypeSignatureNode(@Nonnull SignatureModel source, - @Nonnull Schema target) { + private TypeSignatureNode(@NonNull SignatureModel source, + @NonNull Schema target) { super(source, target); } - @Nonnull - static public TypeSignatureNode of(@Nonnull SignatureModel source) { + @NonNull + static public TypeSignatureNode of(@NonNull SignatureModel source) { return new TypeSignatureNode(source, new Schema<>()); } } diff --git a/packages/java/parser-jvm-plugin-backbone/pom.xml b/packages/java/parser-jvm-plugin-backbone/pom.xml index 16d6c8e00c..0ed996e1cb 100644 --- a/packages/java/parser-jvm-plugin-backbone/pom.xml +++ b/packages/java/parser-jvm-plugin-backbone/pom.xml @@ -32,8 +32,8 @@ test - com.google.code.findbugs - jsr305 + org.jspecify + jspecify org.junit.jupiter diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java index bcd381276b..34c591d0ce 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java @@ -1,9 +1,9 @@ package com.vaadin.hilla.parser.plugins.backbone; -import javax.annotation.Nonnull; - import java.util.stream.Stream; +import org.jspecify.annotations.NonNull; + import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.Node; import com.vaadin.hilla.parser.core.NodeDependencies; @@ -32,10 +32,10 @@ public void enter(NodePath nodePath) { public void exit(NodePath nodePath) { } - @Nonnull + @NonNull @Override - public Node resolve(@Nonnull Node node, - @Nonnull NodePath parentPath) { + public Node resolve(@NonNull Node node, + @NonNull NodePath parentPath) { if (node instanceof MethodNode && parentPath.getNode() instanceof EndpointExposedNode) { return MethodNode.of(((MethodNode) node).getSource()); @@ -53,9 +53,9 @@ public void exit(NodePath nodePath) { (TypeParameterModel) signature, parentPath)); } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { var node = nodeDependencies.getNode(); if (node instanceof EndpointNode || node instanceof EndpointExposedNode diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java index f0c86d529c..ef06aa9c32 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java @@ -5,7 +5,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.models.AnnotationInfoModel; import org.slf4j.Logger; @@ -60,9 +60,9 @@ public void exit(NodePath nodePath) { } } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { if (nodeDependencies.getNode() instanceof RootNode) { var rootNode = (RootNode) nodeDependencies.getNode(); var endpointAnnotationName = getStorage().getParserConfig() diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EntityPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EntityPlugin.java index ea6e796178..2dc3e2ef5e 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EntityPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EntityPlugin.java @@ -5,7 +5,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; @@ -63,9 +63,9 @@ public void exit(NodePath nodePath) { } } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { if (!(nodeDependencies.getNode() instanceof TypedNode)) { return nodeDependencies; } diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/JsonValuePlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/JsonValuePlugin.java index 56b886d34b..e75847ffaa 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/JsonValuePlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/JsonValuePlugin.java @@ -9,7 +9,7 @@ import com.vaadin.hilla.parser.models.*; import com.vaadin.hilla.parser.plugins.backbone.nodes.TypeSignatureNode; import com.vaadin.hilla.parser.plugins.backbone.nodes.TypedNode; -import jakarta.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import java.lang.reflect.Method; import java.util.Arrays; @@ -34,16 +34,16 @@ public void enter(NodePath nodePath) { public void exit(NodePath nodePath) { } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { return nodeDependencies; } - @Nonnull + @NonNull @Override - public Node resolve(@Nonnull Node node, - @Nonnull NodePath parentPath) { + public Node resolve(@NonNull Node node, + @NonNull NodePath parentPath) { if (node instanceof TypedNode typedNode) { if (typedNode .getType() instanceof ClassRefSignatureModel classRefSignatureModel) { diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodParameterPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodParameterPlugin.java index ef9dbd9bf9..d0aa28b050 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodParameterPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodParameterPlugin.java @@ -4,7 +4,7 @@ import java.util.Optional; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.Node; @@ -39,9 +39,9 @@ public void enter(NodePath nodePath) { public void exit(NodePath nodePath) { } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { if (nodeDependencies.getNode() instanceof MethodNode) { var methodNode = (MethodNode) nodeDependencies.getNode(); return nodeDependencies diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodPlugin.java index 727f96f348..732887b5cd 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodPlugin.java @@ -2,7 +2,7 @@ import java.util.Optional; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.Node; @@ -72,9 +72,9 @@ public void exit(NodePath nodePath) { endpointNode.getSource().getName()); } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { var node = nodeDependencies.getNode(); if (node instanceof EndpointNode || node instanceof EndpointExposedNode) { diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/PropertyPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/PropertyPlugin.java index eae601b3b5..fe41aef879 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/PropertyPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/PropertyPlugin.java @@ -24,7 +24,7 @@ import com.vaadin.hilla.parser.plugins.backbone.nodes.EntityNode; import com.vaadin.hilla.parser.plugins.backbone.nodes.PropertyNode; -import jakarta.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public final class PropertyPlugin extends AbstractPlugin { @@ -48,9 +48,9 @@ public void enter(NodePath nodePath) { public void exit(NodePath nodePath) { } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { if (!(nodeDependencies.getNode() instanceof EntityNode)) { return nodeDependencies; } @@ -79,7 +79,7 @@ public void setConfiguration(PluginConfiguration configuration) { } private Stream collectProperties( - @Nonnull ClassInfoModel model) { + @NonNull ClassInfoModel model) { var cls = Objects.requireNonNull(model).get(); if (!(cls instanceof Class)) { diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/TypeSignaturePlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/TypeSignaturePlugin.java index c3af763408..4283167efb 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/TypeSignaturePlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/TypeSignaturePlugin.java @@ -9,7 +9,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; @@ -113,9 +113,9 @@ public void exit(NodePath nodePath) { } } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { var node = nodeDependencies.getNode(); if (node instanceof MethodNode) { return scanMethodNode((MethodNode) node, nodeDependencies); diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/CompositeTypeSignatureNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/CompositeTypeSignatureNode.java index 9e9b151ae6..6d9fb100a2 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/CompositeTypeSignatureNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/CompositeTypeSignatureNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import java.util.Collection; import java.util.List; @@ -18,20 +18,20 @@ public final class CompositeTypeSignatureNode extends private final List annotations; - private CompositeTypeSignatureNode(@Nonnull List source, - @Nonnull Schema target, List annotations) { + private CompositeTypeSignatureNode(@NonNull List source, + @NonNull Schema target, List annotations) { super(source, target); this.annotations = annotations; } - private CompositeTypeSignatureNode(@Nonnull List source, - @Nonnull Schema target) { + private CompositeTypeSignatureNode(@NonNull List source, + @NonNull Schema target) { this(source, target, extractAnnotations(source)); } - @Nonnull + @NonNull static public CompositeTypeSignatureNode of( - @Nonnull List source) { + @NonNull List source) { return new CompositeTypeSignatureNode(source, new Schema<>()); } @@ -47,7 +47,7 @@ public SignatureModel getType() { @Override public TypedNode processType( - @Nonnull UnaryOperator typeProcessor) { + @NonNull UnaryOperator typeProcessor) { var processedTypes = getSource().stream().map(typeProcessor) .collect(Collectors.toList()); if (processedTypes.equals(getSource())) { diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointExposedNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointExposedNode.java index 720168f291..c950bb6946 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointExposedNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointExposedNode.java @@ -1,18 +1,18 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; public final class EndpointExposedNode extends AbstractNode { - private EndpointExposedNode(@Nonnull ClassInfoModel classInfo) { + private EndpointExposedNode(@NonNull ClassInfoModel classInfo) { super(classInfo, null); } - @Nonnull - public static EndpointExposedNode of(@Nonnull ClassInfoModel classInfo) { + @NonNull + public static EndpointExposedNode of(@NonNull ClassInfoModel classInfo) { return new EndpointExposedNode(classInfo); } } diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNode.java index b1e6c7b790..9bdb88f564 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNode.java @@ -1,18 +1,18 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; import io.swagger.v3.oas.models.tags.Tag; public final class EndpointNode extends AbstractNode { - private EndpointNode(@Nonnull ClassInfoModel value, @Nonnull Tag schema) { + private EndpointNode(@NonNull ClassInfoModel value, @NonNull Tag schema) { super(value, schema); } - @Nonnull - public static EndpointNode of(@Nonnull ClassInfoModel cls) { + @NonNull + public static EndpointNode of(@NonNull ClassInfoModel cls) { return new EndpointNode(cls, new Tag()); } } diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNonExposedNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNonExposedNode.java index 573bf1cc54..660983bd89 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNonExposedNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNonExposedNode.java @@ -1,18 +1,18 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; public final class EndpointNonExposedNode extends AbstractNode { - private EndpointNonExposedNode(@Nonnull ClassInfoModel classInfo) { + private EndpointNonExposedNode(@NonNull ClassInfoModel classInfo) { super(classInfo, null); } - @Nonnull - public static EndpointNonExposedNode of(@Nonnull ClassInfoModel classInfo) { + @NonNull + public static EndpointNonExposedNode of(@NonNull ClassInfoModel classInfo) { return new EndpointNonExposedNode(classInfo); } } diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointSignatureNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointSignatureNode.java index 0dee8be2f3..10bab84236 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointSignatureNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointSignatureNode.java @@ -1,18 +1,18 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.SignatureModel; public final class EndpointSignatureNode extends AbstractNode { - private EndpointSignatureNode(@Nonnull SignatureModel source) { + private EndpointSignatureNode(@NonNull SignatureModel source) { super(source, null); } - @Nonnull - static public EndpointSignatureNode of(@Nonnull SignatureModel source) { + @NonNull + static public EndpointSignatureNode of(@NonNull SignatureModel source) { return new EndpointSignatureNode(source); } } diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EntityNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EntityNode.java index 893ef4467e..6368a7e1ab 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EntityNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EntityNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; @@ -8,13 +8,13 @@ import io.swagger.v3.oas.models.media.Schema; public final class EntityNode extends AbstractNode> { - private EntityNode(@Nonnull ClassInfoModel source, - @Nonnull ObjectSchema target) { + private EntityNode(@NonNull ClassInfoModel source, + @NonNull ObjectSchema target) { super(source, target); } - @Nonnull - static public EntityNode of(@Nonnull ClassInfoModel model) { + @NonNull + static public EntityNode of(@NonNull ClassInfoModel model) { return new EntityNode(model, new ObjectSchema()); } } diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodNode.java index 44ac2dc348..e4eba903da 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodNode.java @@ -1,19 +1,19 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.MethodInfoModel; import io.swagger.v3.oas.models.PathItem; public final class MethodNode extends AbstractNode { - private MethodNode(@Nonnull MethodInfoModel source, - @Nonnull PathItem target) { + private MethodNode(@NonNull MethodInfoModel source, + @NonNull PathItem target) { super(source, target); } - @Nonnull - static public MethodNode of(@Nonnull MethodInfoModel model) { + @NonNull + static public MethodNode of(@NonNull MethodInfoModel model) { return new MethodNode(model, new PathItem()); } } diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodParameterNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodParameterNode.java index fee5262856..332ab9b2b3 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodParameterNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodParameterNode.java @@ -1,20 +1,20 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.MethodParameterInfoModel; public final class MethodParameterNode extends AbstractNode { - private MethodParameterNode(@Nonnull MethodParameterInfoModel source, + private MethodParameterNode(@NonNull MethodParameterInfoModel source, String target) { super(source, target); } - @Nonnull + @NonNull static public MethodParameterNode of( - @Nonnull MethodParameterInfoModel source, @Nonnull String target) { + @NonNull MethodParameterInfoModel source, @NonNull String target) { return new MethodParameterNode(source, target); } } diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/PropertyNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/PropertyNode.java index fa6b0a40b1..eedaf61a06 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/PropertyNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/PropertyNode.java @@ -1,19 +1,19 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.jackson.JacksonPropertyModel; public final class PropertyNode extends AbstractNode { - private PropertyNode(@Nonnull JacksonPropertyModel source, - @Nonnull String target) { + private PropertyNode(@NonNull JacksonPropertyModel source, + @NonNull String target) { super(source, target); } - @Nonnull - static public PropertyNode of(@Nonnull JacksonPropertyModel source) { + @NonNull + static public PropertyNode of(@NonNull JacksonPropertyModel source) { return new PropertyNode(source, ""); } } diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/TypeSignatureNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/TypeSignatureNode.java index 1132776568..77eab83509 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/TypeSignatureNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/TypeSignatureNode.java @@ -9,7 +9,7 @@ import com.vaadin.hilla.parser.models.SignatureModel; import io.swagger.v3.oas.models.media.Schema; -import jakarta.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public final class TypeSignatureNode extends AbstractNode> implements TypedNode { @@ -47,13 +47,13 @@ public TypedNode processType(UnaryOperator typeProcessor) { getTarget(), annotations, position); } - @Nonnull - static public TypeSignatureNode of(@Nonnull SignatureModel source) { + @NonNull + static public TypeSignatureNode of(@NonNull SignatureModel source) { return new TypeSignatureNode(source, new Schema<>(), null); } - @Nonnull - static public TypeSignatureNode of(@Nonnull SignatureModel source, + @NonNull + static public TypeSignatureNode of(@NonNull SignatureModel source, int position) { return new TypeSignatureNode(source, new Schema<>(), position); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/TypedNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/TypedNode.java index 5d9080c3c2..6e2facbaac 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/TypedNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/TypedNode.java @@ -5,16 +5,16 @@ import com.vaadin.hilla.parser.models.SignatureModel; import io.swagger.v3.oas.models.media.Schema; -import jakarta.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public interface TypedNode extends AnnotatedNode { - @Nonnull + @NonNull SignatureModel getType(); Schema getTarget(); void setTarget(Schema target); - @Nonnull - TypedNode processType(@Nonnull UnaryOperator typeProcessor); + @NonNull + TypedNode processType(@NonNull UnaryOperator typeProcessor); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java index 1b08aff1c1..1ac6d6d295 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java @@ -2,7 +2,7 @@ requires io.swagger.v3.core; requires io.swagger.v3.oas.models; requires io.github.classgraph; - requires jsr305; + requires org.jspecify; requires com.fasterxml.jackson.databind; requires com.vaadin.hilla.parser.utils; requires transitive com.vaadin.hilla.parser.core; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PagedData.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PagedData.java index 8311db6697..b22af3dafd 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PagedData.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PagedData.java @@ -20,10 +20,12 @@ import java.util.List; import java.util.Map; +import org.jspecify.annotations.NonNull; + @EndpointExposed public interface PagedData { - default List<@Nonnull T> getNonNullablePage(int pageSize, int pageNumber, - Map parameters) { + default List<@NonNull T> getNonNullablePage(int pageSize, int pageNumber, + Map parameters) { return Collections.emptyList(); } diff --git a/packages/java/parser-jvm-plugin-model/pom.xml b/packages/java/parser-jvm-plugin-model/pom.xml index 8d8aff9e5b..bd82c4bb6f 100644 --- a/packages/java/parser-jvm-plugin-model/pom.xml +++ b/packages/java/parser-jvm-plugin-model/pom.xml @@ -21,8 +21,8 @@ - com.google.code.findbugs - jsr305 + org.jspecify + jspecify io.github.classgraph diff --git a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/Annotation.java b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/Annotation.java index 677d34e5d5..aa7ce970a6 100644 --- a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/Annotation.java +++ b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/Annotation.java @@ -1,13 +1,13 @@ package com.vaadin.hilla.parser.plugins.model; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import java.util.Map; public final class Annotation { private final Map attributes; private final String name; - public Annotation(@Nonnull String name, Map attributes) { + public Annotation(@NonNull String name, Map attributes) { this.name = name; this.attributes = attributes; } @@ -16,7 +16,7 @@ public Map getAttributes() { return attributes; } - @Nonnull + @NonNull public String getName() { return name; } diff --git a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ModelPlugin.java b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ModelPlugin.java index 8716aa68c1..07880d524a 100644 --- a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ModelPlugin.java +++ b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ModelPlugin.java @@ -7,7 +7,7 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; @@ -111,9 +111,9 @@ public Collection> getRequiredPlugins() { return List.of(BackbonePlugin.class); } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { return nodeDependencies; } diff --git a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ValidationConstraint.java b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ValidationConstraint.java index d662e4561d..c0339a661f 100644 --- a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ValidationConstraint.java +++ b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ValidationConstraint.java @@ -2,13 +2,13 @@ import java.util.Map; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; public final class ValidationConstraint { private final Map attributes; private final String simpleName; - public ValidationConstraint(@Nonnull String simpleName, + public ValidationConstraint(@NonNull String simpleName, Map attributes) { this.simpleName = simpleName; this.attributes = attributes; @@ -18,7 +18,7 @@ public Map getAttributes() { return attributes; } - @Nonnull + @NonNull public String getSimpleName() { return simpleName; } diff --git a/packages/java/parser-jvm-plugin-model/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-model/src/main/java/module-info.java index 5ba2bf9792..569edf5d3f 100644 --- a/packages/java/parser-jvm-plugin-model/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-model/src/main/java/module-info.java @@ -4,7 +4,7 @@ requires com.vaadin.hilla.parser.plugins.backbone; requires com.vaadin.hilla.parser.utils; requires jakarta.annotation; - requires jsr305; + requires org.jspecify; requires io.github.classgraph; requires io.swagger.v3.oas.models; diff --git a/packages/java/parser-jvm-plugin-nonnull/pom.xml b/packages/java/parser-jvm-plugin-nonnull/pom.xml index 9660b49e28..a32c74ee01 100644 --- a/packages/java/parser-jvm-plugin-nonnull/pom.xml +++ b/packages/java/parser-jvm-plugin-nonnull/pom.xml @@ -26,8 +26,8 @@ ${project.version} - com.google.code.findbugs - jsr305 + org.jspecify + jspecify io.github.classgraph diff --git a/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/AnnotationMatcher.java b/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/AnnotationMatcher.java index 16bc9f09a0..8702ca7f50 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/AnnotationMatcher.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/AnnotationMatcher.java @@ -2,7 +2,7 @@ import java.util.Objects; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; /** * Describes annotations that make class members and their signatures nullable @@ -16,7 +16,7 @@ public final class AnnotationMatcher { public AnnotationMatcher() { } - public AnnotationMatcher(@Nonnull String name, boolean makesNullable, + public AnnotationMatcher(@NonNull String name, boolean makesNullable, int score) { this.name = Objects.requireNonNull(name); this.makesNullable = makesNullable; diff --git a/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPlugin.java b/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPlugin.java index 8f6bc109ef..84c5903287 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPlugin.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPlugin.java @@ -10,7 +10,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; @@ -132,14 +132,14 @@ public Collection> getRequiredPlugins() { return List.of(BackbonePlugin.class); } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { return nodeDependencies; } @Override - public void setConfiguration(@Nonnull PluginConfiguration configuration) { + public void setConfiguration(@NonNull PluginConfiguration configuration) { super.setConfiguration(configuration); this.annotationsMap = mapByName( new NonnullPluginConfig.Processor(getConfiguration()) diff --git a/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPluginConfig.java b/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPluginConfig.java index 40b197e597..46b54f0f49 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPluginConfig.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPluginConfig.java @@ -62,6 +62,8 @@ static class Processor extends ConfigList.Processor { new AnnotationMatcher("org.eclipse.jdt.annotation.Nullable", true, 20), new AnnotationMatcher("com.vaadin.hilla.Nullable", true, 20), + new AnnotationMatcher("org.jspecify.annotations.Nullable", true, + 20), // Nonnull-like annotations have the highest score for // compatibility with the old generator new AnnotationMatcher("jakarta.annotation.Nonnull", false, 30), @@ -72,7 +74,9 @@ static class Processor extends ConfigList.Processor { new AnnotationMatcher("androidx.annotation.NonNull", false, 30), new AnnotationMatcher("org.eclipse.jdt.annotation.NonNull", false, 30), - new AnnotationMatcher("com.vaadin.hilla.Nonnull", false, 30)); + new AnnotationMatcher("com.vaadin.hilla.Nonnull", false, 30), + new AnnotationMatcher("org.jspecify.annotations.NonNull", false, + 30)); public Processor(NonnullPluginConfig config) { super(config, defaults); diff --git a/packages/java/parser-jvm-plugin-nonnull/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-nonnull/src/main/java/module-info.java index 79fb603c70..1d9b6df516 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/main/java/module-info.java @@ -2,7 +2,7 @@ requires com.fasterxml.jackson.databind; requires com.vaadin.hilla.parser.plugins.backbone; requires com.vaadin.hilla.parser.utils; - requires jsr305; + requires org.jspecify; requires jakarta.annotation; requires io.swagger.v3.oas.models; requires io.github.classgraph; diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicEndpoint.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicEndpoint.java index 5e28daf6d5..698e3dd800 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicEndpoint.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicEndpoint.java @@ -12,14 +12,14 @@ public class BasicEndpoint { return map; } - @javax.annotation.Nonnull + @org.jspecify.annotations.NonNull public List<@Nonnull String> mixedAnnotations(@Nonnull String parameter) { return List.of(parameter); } - @javax.annotation.Nonnull + @org.jspecify.annotations.NonNull public String nonTypeAnnotation( - @javax.annotation.Nonnull String nonTypeParameter) { + @org.jspecify.annotations.NonNull String nonTypeParameter) { return nonTypeParameter; } @@ -59,10 +59,10 @@ public NonNullableFieldModel nonNullableFieldModel( } public static class ExtendedNonNullableModel extends NonNullableModel { - @javax.annotation.Nonnull + @org.jspecify.annotations.NonNull public List<@Nonnull String> mixedAnnotations; - @javax.annotation.Nonnull + @org.jspecify.annotations.NonNull public String nonTypeAnnotation; } diff --git a/packages/java/parser-jvm-plugin-subtypes/pom.xml b/packages/java/parser-jvm-plugin-subtypes/pom.xml index 0854f7164c..8ed6586c62 100644 --- a/packages/java/parser-jvm-plugin-subtypes/pom.xml +++ b/packages/java/parser-jvm-plugin-subtypes/pom.xml @@ -26,8 +26,8 @@ ${project.version} - com.google.code.findbugs - jsr305 + org.jspecify + jspecify io.github.classgraph diff --git a/packages/java/parser-jvm-plugin-subtypes/src/main/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesPlugin.java b/packages/java/parser-jvm-plugin-subtypes/src/main/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesPlugin.java index f1eaf13873..4ad9adbe3a 100644 --- a/packages/java/parser-jvm-plugin-subtypes/src/main/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesPlugin.java +++ b/packages/java/parser-jvm-plugin-subtypes/src/main/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesPlugin.java @@ -21,7 +21,7 @@ import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.StringSchema; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -97,9 +97,9 @@ public Collection> getRequiredPlugins() { return List.of(BackbonePlugin.class); } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { if (!(nodeDependencies.getNode() instanceof TypedNode)) { return nodeDependencies; } @@ -142,13 +142,13 @@ private static Stream getJsonSubTypes(Class cls) { */ public static class UnionNode extends AbstractNode> { - private UnionNode(@Nonnull ClassInfoModel source, - @Nonnull ObjectSchema target) { + private UnionNode(@NonNull ClassInfoModel source, + @NonNull ObjectSchema target) { super(source, target); } - @Nonnull - static public UnionNode of(@Nonnull ClassInfoModel model) { + @NonNull + static public UnionNode of(@NonNull ClassInfoModel model) { return new UnionNode(model, new ObjectSchema()); } } diff --git a/packages/java/parser-jvm-plugin-subtypes/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-subtypes/src/main/java/module-info.java index 2982aed1cf..f46af1dd80 100644 --- a/packages/java/parser-jvm-plugin-subtypes/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-subtypes/src/main/java/module-info.java @@ -2,7 +2,7 @@ requires com.fasterxml.jackson.databind; requires com.vaadin.hilla.parser.plugins.backbone; requires com.vaadin.hilla.parser.utils; - requires jsr305; + requires org.jspecify; requires jakarta.annotation; requires io.swagger.v3.oas.models; requires io.github.classgraph; diff --git a/packages/java/parser-jvm-plugin-transfertypes/pom.xml b/packages/java/parser-jvm-plugin-transfertypes/pom.xml index cb509a93ba..1184e499a2 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/pom.xml +++ b/packages/java/parser-jvm-plugin-transfertypes/pom.xml @@ -26,8 +26,8 @@ ${project.version} - com.google.code.findbugs - jsr305 + org.jspecify + jspecify io.github.classgraph diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/com/vaadin/hilla/parser/plugins/transfertypes/TransferTypesPlugin.java b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/com/vaadin/hilla/parser/plugins/transfertypes/TransferTypesPlugin.java index 628384c86e..1bb43420c9 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/com/vaadin/hilla/parser/plugins/transfertypes/TransferTypesPlugin.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/com/vaadin/hilla/parser/plugins/transfertypes/TransferTypesPlugin.java @@ -7,7 +7,7 @@ import java.util.UUID; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; @@ -67,9 +67,9 @@ public Collection> getRequiredPlugins() { return List.of(BackbonePlugin.class); } - @Nonnull + @NonNull @Override - public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { + public NodeDependencies scan(@NonNull NodeDependencies nodeDependencies) { return nodeDependencies.processChildNodes(this::processNodes) .processRelatedNodes(this::processNodes); } diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java index 7ba23a325c..88f1f04d2d 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java @@ -4,7 +4,7 @@ requires com.vaadin.hilla.parser.plugins.backbone; requires com.vaadin.hilla.parser.utils; requires com.vaadin.hilla.runtime.transfertypes; - requires jsr305; + requires org.jspecify; requires jakarta.annotation; requires io.swagger.v3.oas.models; requires io.github.classgraph; diff --git a/packages/java/parser-jvm-test-utils/pom.xml b/packages/java/parser-jvm-test-utils/pom.xml index 2d92072135..760a363eff 100644 --- a/packages/java/parser-jvm-test-utils/pom.xml +++ b/packages/java/parser-jvm-test-utils/pom.xml @@ -25,8 +25,8 @@ junit-jupiter - com.google.code.findbugs - jsr305 + org.jspecify + jspecify com.fasterxml.jackson.core diff --git a/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java b/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java index 5e85e32cd8..5f42126f96 100644 --- a/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java +++ b/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java @@ -8,7 +8,7 @@ import java.util.Objects; import java.util.stream.Collectors; -import javax.annotation.Nonnull; +import org.jspecify.annotations.NonNull; /** * A converter for relative paths of @@ -24,7 +24,7 @@ public final class TestEngineConfigurationPathResolver { private static final String CLASS_NAME = "com.vaadin.hilla.engine.EngineConfiguration"; private static final String CLASS_PATH_FIELD_NAME = "classPath"; - public static T resolve(@Nonnull T obj, @Nonnull Path baseDir) + public static T resolve(@NonNull T obj, @NonNull Path baseDir) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException { Objects.requireNonNull(baseDir); diff --git a/packages/java/parser-jvm-test-utils/src/main/java/module-info.java b/packages/java/parser-jvm-test-utils/src/main/java/module-info.java index a76571807b..3ee96f8ba0 100644 --- a/packages/java/parser-jvm-test-utils/src/main/java/module-info.java +++ b/packages/java/parser-jvm-test-utils/src/main/java/module-info.java @@ -1,7 +1,7 @@ module com.vaadin.hilla.parser.testutils { requires com.fasterxml.jackson.databind; requires com.vaadin.hilla.parser.utils; - requires jsr305; + requires org.jspecify; requires io.swagger.v3.oas.models; requires io.swagger.v3.core; requires org.junit.jupiter.api; diff --git a/packages/java/parser-jvm-utils/pom.xml b/packages/java/parser-jvm-utils/pom.xml index d6f0d85163..ba8289e873 100644 --- a/packages/java/parser-jvm-utils/pom.xml +++ b/packages/java/parser-jvm-utils/pom.xml @@ -20,8 +20,8 @@ - com.google.code.findbugs - jsr305 + org.jspecify + jspecify io.swagger.core.v3 diff --git a/packages/java/parser-jvm-utils/src/main/java/module-info.java b/packages/java/parser-jvm-utils/src/main/java/module-info.java index 981a614850..2a466ce335 100644 --- a/packages/java/parser-jvm-utils/src/main/java/module-info.java +++ b/packages/java/parser-jvm-utils/src/main/java/module-info.java @@ -1,5 +1,5 @@ module com.vaadin.hilla.parser.utils { - requires jsr305; + requires org.jspecify; requires com.fasterxml.jackson.core; requires com.fasterxml.jackson.databind; requires io.swagger.v3.core; diff --git a/packages/java/runtime-plugin-transfertypes/pom.xml b/packages/java/runtime-plugin-transfertypes/pom.xml index 986574be6a..a809f24376 100644 --- a/packages/java/runtime-plugin-transfertypes/pom.xml +++ b/packages/java/runtime-plugin-transfertypes/pom.xml @@ -21,8 +21,8 @@ - com.google.code.findbugs - jsr305 + org.jspecify + jspecify org.junit.jupiter diff --git a/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Order.java b/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Order.java index 16038ae2e1..970df64587 100644 --- a/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Order.java +++ b/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Order.java @@ -15,7 +15,7 @@ */ package com.vaadin.hilla.mappedtypes; -import jakarta.annotation.Nonnull; +import org.jspecify.annotations.NonNull; import jakarta.validation.constraints.NotBlank; import org.springframework.data.domain.Sort.Direction; @@ -25,9 +25,9 @@ * A DTO for {@code org.springframework.data.domain.Sort.Order}. */ public class Order { - @Nonnull + @NonNull private Direction direction; - @Nonnull + @NonNull @NotBlank private String property; private boolean ignoreCase; diff --git a/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Pageable.java b/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Pageable.java index 7a672601a7..fb68bc3550 100644 --- a/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Pageable.java +++ b/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Pageable.java @@ -15,7 +15,7 @@ */ package com.vaadin.hilla.mappedtypes; -import jakarta.annotation.Nonnull; +import org.jspecify.annotations.NonNull; /** * A DTO for {@code org.springframework.data.domain.Pageable}. @@ -23,7 +23,7 @@ public class Pageable { private int pageNumber; private int pageSize; - @Nonnull + @NonNull private Sort sort = new Sort(); public int getPageNumber() { diff --git a/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Sort.java b/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Sort.java index 7777d03a85..500a366870 100644 --- a/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Sort.java +++ b/packages/java/runtime-plugin-transfertypes/src/main/java/com/vaadin/hilla/mappedtypes/Sort.java @@ -18,13 +18,13 @@ import java.util.ArrayList; import java.util.List; -import jakarta.annotation.Nonnull; +import org.jspecify.annotations.NonNull; /** * A DTO for {@code org.springframework.data.domain.Sort}. */ public class Sort { - @Nonnull + @NonNull private List orders = new ArrayList<>(); public List getOrders() { diff --git a/packages/java/runtime-plugin-transfertypes/src/main/java/module-info.java b/packages/java/runtime-plugin-transfertypes/src/main/java/module-info.java index ff362e56d5..2af194a285 100644 --- a/packages/java/runtime-plugin-transfertypes/src/main/java/module-info.java +++ b/packages/java/runtime-plugin-transfertypes/src/main/java/module-info.java @@ -1,5 +1,5 @@ module com.vaadin.hilla.runtime.transfertypes { - requires jsr305; + requires org.jspecify; requires spring.data.commons; requires jakarta.validation; requires jakarta.annotation; diff --git a/packages/java/tests/gradle/single-module-tests/src/main/java/com/vaadin/hilla/gradle/plugin/test/endpoint/HelloReactEndpoint.java b/packages/java/tests/gradle/single-module-tests/src/main/java/com/vaadin/hilla/gradle/plugin/test/endpoint/HelloReactEndpoint.java index 6f4ef448db..be2d9c2cd7 100644 --- a/packages/java/tests/gradle/single-module-tests/src/main/java/com/vaadin/hilla/gradle/plugin/test/endpoint/HelloReactEndpoint.java +++ b/packages/java/tests/gradle/single-module-tests/src/main/java/com/vaadin/hilla/gradle/plugin/test/endpoint/HelloReactEndpoint.java @@ -1,15 +1,16 @@ package com.vaadin.hilla.gradle.plugin.test.endpoint; +import org.jspecify.annotations.NonNull; + import com.vaadin.flow.server.auth.AnonymousAllowed; import com.vaadin.hilla.Endpoint; -import com.vaadin.hilla.Nonnull; @Endpoint @AnonymousAllowed public class HelloReactEndpoint { - @Nonnull - public String sayHello(@Nonnull String name) { + @NonNull + public String sayHello(@NonNull String name) { if (name.isEmpty()) { return "Hello stranger"; } else { diff --git a/packages/java/tests/gradle/single-module/src/main/java/com/vaadin/hilla/gradle/plugin/test/endpoint/HelloReactEndpoint.java b/packages/java/tests/gradle/single-module/src/main/java/com/vaadin/hilla/gradle/plugin/test/endpoint/HelloReactEndpoint.java index 6f4ef448db..be2d9c2cd7 100644 --- a/packages/java/tests/gradle/single-module/src/main/java/com/vaadin/hilla/gradle/plugin/test/endpoint/HelloReactEndpoint.java +++ b/packages/java/tests/gradle/single-module/src/main/java/com/vaadin/hilla/gradle/plugin/test/endpoint/HelloReactEndpoint.java @@ -1,15 +1,16 @@ package com.vaadin.hilla.gradle.plugin.test.endpoint; +import org.jspecify.annotations.NonNull; + import com.vaadin.flow.server.auth.AnonymousAllowed; import com.vaadin.hilla.Endpoint; -import com.vaadin.hilla.Nonnull; @Endpoint @AnonymousAllowed public class HelloReactEndpoint { - @Nonnull - public String sayHello(@Nonnull String name) { + @NonNull + public String sayHello(@NonNull String name) { if (name.isEmpty()) { return "Hello stranger"; } else { diff --git a/packages/java/tests/spring/endpoints-latest-java/src/main/java/com/vaadin/flow/connect/AppEndpoint.java b/packages/java/tests/spring/endpoints-latest-java/src/main/java/com/vaadin/flow/connect/AppEndpoint.java index b14187b11d..bda97897f6 100644 --- a/packages/java/tests/spring/endpoints-latest-java/src/main/java/com/vaadin/flow/connect/AppEndpoint.java +++ b/packages/java/tests/spring/endpoints-latest-java/src/main/java/com/vaadin/flow/connect/AppEndpoint.java @@ -1,10 +1,10 @@ package com.vaadin.flow.connect; import com.vaadin.flow.server.auth.AnonymousAllowed; - import com.vaadin.hilla.Endpoint; -import com.vaadin.hilla.Nonnull; -import com.vaadin.hilla.Nullable; + +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; /** * Simple Vaadin Connect Service definition. @@ -13,7 +13,7 @@ @AnonymousAllowed public class AppEndpoint { - @Nonnull + @NonNull public String hello(@Nullable String name) { // This intentionally uses Java 17 syntax to ensure it works switch (name) { diff --git a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/AnnotatedEndpoint.java b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/AnnotatedEndpoint.java index 7765a045ed..094ec8599c 100644 --- a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/AnnotatedEndpoint.java +++ b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/AnnotatedEndpoint.java @@ -1,11 +1,12 @@ package com.vaadin.flow.connect; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.vaadin.hilla.Endpoint; -import com.vaadin.hilla.Nonnull; import jakarta.validation.constraints.NotBlank; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jspecify.annotations.NonNull; + import com.vaadin.flow.server.auth.AnonymousAllowed; +import com.vaadin.hilla.Endpoint; /** * Endpoint to verify Jackson annotations support. @@ -25,13 +26,13 @@ public static class AnnotatedEntity { private String defaultName = "value"; @JsonProperty("customName") - @Nonnull + @NonNull public String getDefaultName() { return "value"; } @JsonProperty("customName") - public void setDefaultName(@Nonnull String defaultName) { + public void setDefaultName(@NonNull String defaultName) { this.defaultName = defaultName; } } diff --git a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/AppEndpoint.java b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/AppEndpoint.java index becec6b5e1..8a357ef968 100644 --- a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/AppEndpoint.java +++ b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/AppEndpoint.java @@ -7,9 +7,10 @@ import com.vaadin.flow.server.VaadinRequest; import com.vaadin.flow.server.auth.AnonymousAllowed; - import com.vaadin.hilla.Endpoint; -import com.vaadin.hilla.Nullable; + +import org.jspecify.annotations.Nullable; + import jakarta.annotation.security.PermitAll; import jakarta.annotation.security.RolesAllowed; diff --git a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/FluxEndpoint.java b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/FluxEndpoint.java index cde42e93fd..7effdea7bf 100644 --- a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/FluxEndpoint.java +++ b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/FluxEndpoint.java @@ -2,15 +2,14 @@ import java.time.Duration; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; import org.springframework.security.authentication.AnonymousAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import com.vaadin.flow.server.auth.AnonymousAllowed; - import com.vaadin.hilla.Endpoint; -import com.vaadin.hilla.Nonnull; -import com.vaadin.hilla.Nullable; import jakarta.annotation.security.PermitAll; import jakarta.annotation.security.RolesAllowed; import reactor.core.publisher.Flux; @@ -19,32 +18,32 @@ public class FluxEndpoint { // DenyAll by default - @Nonnull + @NonNull public Flux denied() { return Flux.just("Will never be accessible"); } @PermitAll - @Nonnull + @NonNull public Flux hello(String name, @Nullable String title) { return Flux.just( "Hello, " + (title != null ? title + " " : "") + name + "!"); } @AnonymousAllowed - @Nonnull + @NonNull public Flux helloAnonymous() { return Flux.just("Hello, stranger!"); } @RolesAllowed("ADMIN") - @Nonnull + @NonNull public Flux helloAdmin() { return Flux.just("Hello, admin!"); } @AnonymousAllowed - @Nonnull + @NonNull public Flux checkUser() { Authentication auth = SecurityContextHolder.getContext() .getAuthentication(); @@ -55,20 +54,20 @@ public Flux checkUser() { } @AnonymousAllowed - @Nonnull + @NonNull public Flux countTo(int n) { return Flux.range(1, n).delayElements(Duration.ofMillis(200)); } @AnonymousAllowed - @Nonnull + @NonNull public Flux countEvenTo(int n) { return Flux.range(1, n).delayElements(Duration.ofMillis(200)) .filter(number -> number % 2 == 0); } @AnonymousAllowed - @Nonnull + @NonNull public Flux countThrowError(int n) { return Flux.range(1, n).delayElements(Duration.ofMillis(200)) .filter(number -> { diff --git a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PackagePrivateEndpoint.java b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PackagePrivateEndpoint.java index 20d835c919..a2e6329631 100644 --- a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PackagePrivateEndpoint.java +++ b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PackagePrivateEndpoint.java @@ -1,9 +1,9 @@ package com.vaadin.flow.connect; import com.vaadin.flow.server.auth.AnonymousAllowed; - import com.vaadin.hilla.Endpoint; -import com.vaadin.hilla.Nullable; + +import org.jspecify.annotations.Nullable; import jakarta.annotation.security.PermitAll; /** diff --git a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PagedEndpoint.java b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PagedEndpoint.java index 24b52a86b2..057eba2d1b 100644 --- a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PagedEndpoint.java +++ b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PagedEndpoint.java @@ -7,8 +7,9 @@ import java.util.Objects; import com.vaadin.hilla.Endpoint; -import com.vaadin.hilla.Nonnull; -import com.vaadin.hilla.Nullable; + +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; @@ -28,7 +29,7 @@ public class PagedEndpoint { private static List DATA = List.of(new Entity("Foo", 30), new Entity("Bar", 20), new Entity("Baz", 10)); - public Page<@Nonnull Entity> list(@Nullable Pageable p) { + public Page<@NonNull Entity> list(@Nullable Pageable p) { if (p == null) { p = PageRequest.of(0, 2, Sort.by(Sort.Direction.DESC, "qty")); } @@ -50,17 +51,17 @@ public static class Entity { private final int qty; - public Entity(@Nonnull String name, int qty) { + public Entity(@NonNull String name, int qty) { this.name = Objects.requireNonNull(name); this.qty = qty; } - @Nonnull + @NonNull public String getName() { return name; } - @Nonnull + @NonNull public int getQty() { return qty; } @@ -73,13 +74,13 @@ public static class PageOfEntities { private final Page page; private final Pageable pageable; - public PageOfEntities(@Nonnull Page page, - @Nonnull Pageable pageable) { + public PageOfEntities(@NonNull Page page, + @NonNull Pageable pageable) { this.page = page; this.pageable = pageable; } - public PageOfEntities(@Nonnull Page page) { + public PageOfEntities(@NonNull Page page) { this(page, page.getPageable()); } diff --git a/packages/java/tests/spring/native/src/main/java/com/example/application/endpoints/ChatService.java b/packages/java/tests/spring/native/src/main/java/com/example/application/endpoints/ChatService.java index 7c5e44b331..f000d3b3f5 100644 --- a/packages/java/tests/spring/native/src/main/java/com/example/application/endpoints/ChatService.java +++ b/packages/java/tests/spring/native/src/main/java/com/example/application/endpoints/ChatService.java @@ -4,13 +4,14 @@ import java.time.Instant; +import com.vaadin.flow.spring.security.AuthenticationContext; import com.vaadin.hilla.Endpoint; -import com.vaadin.hilla.Nonnull; + +import org.jspecify.annotations.NonNull; + import reactor.core.publisher.Flux; import reactor.core.publisher.Sinks; -import com.vaadin.flow.spring.security.AuthenticationContext; - @Endpoint @PermitAll class ChatService { @@ -28,7 +29,7 @@ record Message(String userName, String text, Instant time) { private final Flux chat = chatSink.asFlux(); - public Flux<@Nonnull Message> join() { + public Flux<@NonNull Message> join() { return chat; } diff --git a/packages/java/tests/spring/security/src/main/java/com/vaadin/flow/spring/fusionsecurity/service/GreetingService.java b/packages/java/tests/spring/security/src/main/java/com/vaadin/flow/spring/fusionsecurity/service/GreetingService.java index 38a86fb567..b458a0f5fa 100644 --- a/packages/java/tests/spring/security/src/main/java/com/vaadin/flow/spring/fusionsecurity/service/GreetingService.java +++ b/packages/java/tests/spring/security/src/main/java/com/vaadin/flow/spring/fusionsecurity/service/GreetingService.java @@ -2,7 +2,8 @@ import com.vaadin.flow.server.auth.AnonymousAllowed; import com.vaadin.hilla.BrowserCallable; -import com.vaadin.hilla.Nonnull; + +import org.jspecify.annotations.NonNull; import org.springframework.transaction.annotation.Transactional; @BrowserCallable @@ -10,7 +11,7 @@ public class GreetingService { @AnonymousAllowed - public @Nonnull String sayHello() { + public @NonNull String sayHello() { return "Hello from GreetingService"; } } diff --git a/pom.xml b/pom.xml index 97040d8594..2072b27a78 100644 --- a/pom.xml +++ b/pom.xml @@ -286,6 +286,11 @@ 1.3 test + + org.jspecify + jspecify + 1.0.0 +