diff --git a/flow-server/src/main/java/com/vaadin/flow/Nonnull.java b/flow-server/src/main/java/com/vaadin/flow/Nonnull.java deleted file mode 100644 index a08af410cc6..00000000000 --- a/flow-server/src/main/java/com/vaadin/flow/Nonnull.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2022 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.flow; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation to mark either field, method, parameter or type parameter as - * non-nullable. It is used by Typescript Generator as a source of type - * nullability information. - * - * This annotation exists because the traditional `jakarta.annotation.Nonnull` - * annotation is not applicable to type parameters. - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.TYPE_USE }) -public @interface Nonnull { -} diff --git a/flow-server/src/main/java/com/vaadin/flow/Nullable.java b/flow-server/src/main/java/com/vaadin/flow/Nullable.java deleted file mode 100644 index 39f13ca04ca..00000000000 --- a/flow-server/src/main/java/com/vaadin/flow/Nullable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2022 Vaadin Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ -package com.vaadin.flow; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation to mark either field, method, parameter or type parameter as - * nullable. It is used by Typescript Generator as a source of type nullability - * information. - * - * This annotation exists because the traditional `jakarta.annotation.Nullable` - * annotation is not applicable to type parameters. - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.TYPE_USE }) -public @interface Nullable { -} diff --git a/vaadin-spring/pom.xml b/vaadin-spring/pom.xml index 88cc5a3f21c..ce207540a81 100644 --- a/vaadin-spring/pom.xml +++ b/vaadin-spring/pom.xml @@ -43,6 +43,12 @@ jakarta.servlet-api provided + + org.jspecify + jspecify + 1.0.0 + + com.vaadin @@ -225,13 +231,13 @@ - - org.springframework.boot - spring-boot-dependencies - ${spring.boot.version} - pom - import - + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + diff --git a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/CountService.java b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/CountService.java index 22687e4bafb..5e90a385b7f 100644 --- a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/CountService.java +++ b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/CountService.java @@ -1,6 +1,6 @@ package com.vaadin.flow.spring.data; -import com.vaadin.flow.Nullable; +import org.jspecify.annotations.Nullable; import com.vaadin.flow.spring.data.filter.Filter; diff --git a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/FormService.java b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/FormService.java index 93360e70ecc..63b8a144969 100644 --- a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/FormService.java +++ b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/FormService.java @@ -1,6 +1,6 @@ package com.vaadin.flow.spring.data; -import com.vaadin.flow.Nullable; +import org.jspecify.annotations.Nullable; /** * A service that can create, update, and delete a given type of object. diff --git a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/ListService.java b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/ListService.java index 3d0855aee17..cdbe9519273 100644 --- a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/ListService.java +++ b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/ListService.java @@ -2,11 +2,11 @@ import java.util.List; -import com.vaadin.flow.Nullable; -import com.vaadin.flow.Nonnull; +import org.jspecify.annotations.NonNull; +import org.jspecify.annotations.Nullable; +import org.springframework.data.domain.Pageable; import com.vaadin.flow.spring.data.filter.Filter; -import org.springframework.data.domain.Pageable; /** * A service that can list the given type of object. @@ -22,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/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/jpa/CrudRepositoryService.java b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/jpa/CrudRepositoryService.java index b5803d50d12..d2bcf87e6f4 100644 --- a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/jpa/CrudRepositoryService.java +++ b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/jpa/CrudRepositoryService.java @@ -3,10 +3,10 @@ import java.util.ArrayList; import java.util.List; +import org.jspecify.annotations.Nullable; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.repository.CrudRepository; -import com.vaadin.flow.Nullable; import com.vaadin.flow.spring.data.CrudService; /** diff --git a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/jpa/ListRepositoryService.java b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/jpa/ListRepositoryService.java index 251e90fd9be..02b3d6385b7 100644 --- a/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/jpa/ListRepositoryService.java +++ b/vaadin-spring/src/main/java/com/vaadin/flow/spring/data/jpa/ListRepositoryService.java @@ -5,12 +5,12 @@ import java.util.Optional; import com.googlecode.gentyref.GenericTypeReflector; +import org.jspecify.annotations.Nullable; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.domain.Specification; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.repository.CrudRepository; -import com.vaadin.flow.Nullable; import com.vaadin.flow.spring.data.CountService; import com.vaadin.flow.spring.data.GetService; import com.vaadin.flow.spring.data.ListService;