From 8f7483cf9625fc0a1cb63bf98aa937b8836fe61a Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 14 Nov 2024 11:09:07 +0200 Subject: [PATCH] chore: Format for Java 17 instead of Java 5 (#20185) (CP: 24.4) (#20469) * chore: Format for Java 17 instead of Java 5 (#20185) (CP: 24.4) * format HasValidator.java --------- Co-authored-by: Teppo Kurki --- eclipse/VaadinJavaConventions.xml | 6 ++--- .../vaadin/flow/data/binder/HasValidator.java | 24 +++++++++---------- .../data/provider/DataCommunicatorTest.java | 12 ++++++---- .../data/validator/BeanValidatorTest.java | 3 ++- .../data/validator/RangeValidatorTest.java | 7 ++++-- .../flow/server/webpush/WebPushMessage.java | 9 ++++--- .../com/vaadin/base/devserver/ServerInfo.java | 4 ++-- .../NavigationAccessControlConfigurer.java | 6 +++-- .../security/SpringAccessPathChecker.java | 3 ++- 9 files changed, 44 insertions(+), 30 deletions(-) diff --git a/eclipse/VaadinJavaConventions.xml b/eclipse/VaadinJavaConventions.xml index 62061d817a4..0ca130f61cb 100644 --- a/eclipse/VaadinJavaConventions.xml +++ b/eclipse/VaadinJavaConventions.xml @@ -48,7 +48,7 @@ - + @@ -167,7 +167,7 @@ - + @@ -242,7 +242,7 @@ - + diff --git a/flow-data/src/main/java/com/vaadin/flow/data/binder/HasValidator.java b/flow-data/src/main/java/com/vaadin/flow/data/binder/HasValidator.java index aacc0fabcf9..992ef8fcbc6 100644 --- a/flow-data/src/main/java/com/vaadin/flow/data/binder/HasValidator.java +++ b/flow-data/src/main/java/com/vaadin/flow/data/binder/HasValidator.java @@ -74,31 +74,31 @@ default Validator getDefaultValidator() { * public class DatePickerDemo implements HasValidator<LocalDate> { * * // Each web component has a way to communicate its validation status - * // to its server-side component instance. The following clientSideValid - * // state is introduced here just for the sake of simplicity of this code - * // snippet: + * // to its server-side component instance. The following + * // clientSideValid state is introduced here just for the sake of + * // simplicity of this code snippet: * boolean clientSideValid = true; * * /** - * * Note how clientSideValid engaged in the definition - * * of this method. It is important to reflect this status either - * * in the returning validation result of this method or any other - * * validation that is associated with this component. - * */ + * * Note how clientSideValid engaged in the definition of + * * this method. It is important to reflect this status either in the + * * returning validation result of this method or any other validation + * * that is associated with this component. + * */ * @Override * public Validator getDefaultValidator() { - * return (value, valueContext) -> clientSideValid ? ValidationResult.ok() + * return (value, valueContext) -> clientSideValid + * ? ValidationResult.ok() * : ValidationResult.error("Invalid date format"); * } * - * private final Collection<ValidationStatusChangeListener<LocalDate>> - * validationStatusListeners = new ArrayList<>(); + * private final Collection<ValidationStatusChangeListener<LocalDate>> validationStatusListeners = new ArrayList<>(); * * /** * * This enables the binding to subscribe for the validation status * * change events that are fired by this component and revalidate * * itself respectively. - * */ + * */ * @Override * public Registration addValidationStatusChangeListener( * ValidationStatusChangeListener<LocalDate> listener) { diff --git a/flow-data/src/test/java/com/vaadin/flow/data/provider/DataCommunicatorTest.java b/flow-data/src/test/java/com/vaadin/flow/data/provider/DataCommunicatorTest.java index f6e575dc49e..7258ff1f8d3 100644 --- a/flow-data/src/test/java/com/vaadin/flow/data/provider/DataCommunicatorTest.java +++ b/flow-data/src/test/java/com/vaadin/flow/data/provider/DataCommunicatorTest.java @@ -1312,14 +1312,18 @@ public void fetchFromProvider_disablePaging_singleQueryWithLimit() { @Test public void fetchFromProvider_maxLimitValue_pagesCalculatedProperly() { - AbstractDataProviderdataProvider=createDataProvider(42);dataProvider=Mockito.spy(dataProvider); + AbstractDataProvider dataProvider = createDataProvider( + 42); + dataProvider = Mockito.spy(dataProvider); - dataCommunicator.setDataProvider(dataProvider,null);dataCommunicator.setPageSize(2_000_000_000); + dataCommunicator.setDataProvider(dataProvider, null); + dataCommunicator.setPageSize(2_000_000_000); // We check the page number calculation does not lead to integer // overflow, and not throw thus - dataCommunicator.fetchFromProvider(0,Integer.MAX_VALUE); + dataCommunicator.fetchFromProvider(0, Integer.MAX_VALUE); - Mockito.verify(dataProvider,Mockito.times(1)).fetch(Mockito.any(Query.class)); + Mockito.verify(dataProvider, Mockito.times(1)) + .fetch(Mockito.any(Query.class)); } @Test diff --git a/flow-data/src/test/java/com/vaadin/flow/data/validator/BeanValidatorTest.java b/flow-data/src/test/java/com/vaadin/flow/data/validator/BeanValidatorTest.java index 4f11446bc71..7ad2890f99a 100644 --- a/flow-data/src/test/java/com/vaadin/flow/data/validator/BeanValidatorTest.java +++ b/flow-data/src/test/java/com/vaadin/flow/data/validator/BeanValidatorTest.java @@ -69,7 +69,8 @@ public void testInvalidDecimalsFailsInFrench() { @Test public void testAddressNestedPropertyInvalidPostalCodeFails() { - assertFails(100_000,"must be less than or equal to 99999",validator("address.postalCode")); + assertFails(100_000, "must be less than or equal to 99999", + validator("address.postalCode")); } @Test diff --git a/flow-data/src/test/java/com/vaadin/flow/data/validator/RangeValidatorTest.java b/flow-data/src/test/java/com/vaadin/flow/data/validator/RangeValidatorTest.java index 1f55fb198cd..283158f24cb 100644 --- a/flow-data/src/test/java/com/vaadin/flow/data/validator/RangeValidatorTest.java +++ b/flow-data/src/test/java/com/vaadin/flow/data/validator/RangeValidatorTest.java @@ -109,9 +109,12 @@ public void testNullLessThanEverything() { @Test public void testDateRange() { - RangeValidatorv=RangeValidator.of("Date must be in 2016",LocalDate.of(2016,1,1),LocalDate.of(2016,12,31)); + RangeValidator v = RangeValidator.of("Date must be in 2016", + LocalDate.of(2016, 1, 1), LocalDate.of(2016, 12, 31)); - assertFails(LocalDate.ofEpochDay(0),v);assertPasses(LocalDate.of(2016,7,31),v);assertFails(LocalDate.ofEpochDay(1_000_000_000),v); + assertFails(LocalDate.ofEpochDay(0), v); + assertPasses(LocalDate.of(2016, 7, 31), v); + assertFails(LocalDate.ofEpochDay(1_000_000_000), v); } } diff --git a/flow-webpush/src/main/java/com/vaadin/flow/server/webpush/WebPushMessage.java b/flow-webpush/src/main/java/com/vaadin/flow/server/webpush/WebPushMessage.java index 42ffbf2712a..2aeef24496e 100644 --- a/flow-webpush/src/main/java/com/vaadin/flow/server/webpush/WebPushMessage.java +++ b/flow-webpush/src/main/java/com/vaadin/flow/server/webpush/WebPushMessage.java @@ -26,13 +26,16 @@ * * @since 24.2 */ -public record WebPushMessage(String title, String body) implements Serializable { +public record WebPushMessage(String title, + String body) implements Serializable { /** * Creates a new Web Push notification message with title and body. * - * @param title notification title - * @param body notification body + * @param title + * notification title + * @param body + * notification body */ public WebPushMessage { } diff --git a/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/ServerInfo.java b/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/ServerInfo.java index 3f590cde15b..32fdb367395 100644 --- a/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/ServerInfo.java +++ b/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/ServerInfo.java @@ -28,8 +28,8 @@ */ public class ServerInfo implements Serializable { - public record NameAndVersion(String name, String version) - implements Serializable { + public record NameAndVersion(String name, + String version) implements Serializable { }; private List versions = new ArrayList<>(); diff --git a/vaadin-spring/src/main/java/com/vaadin/flow/spring/security/NavigationAccessControlConfigurer.java b/vaadin-spring/src/main/java/com/vaadin/flow/spring/security/NavigationAccessControlConfigurer.java index 0793f9c8dd4..3a01283f367 100644 --- a/vaadin-spring/src/main/java/com/vaadin/flow/spring/security/NavigationAccessControlConfigurer.java +++ b/vaadin-spring/src/main/java/com/vaadin/flow/spring/security/NavigationAccessControlConfigurer.java @@ -55,7 +55,8 @@ * {@link NavigationAccessControlConfigurer} bean. * *
- * {@code @Bean
+ * {@code
+ * @Bean
  * NavigationAccessControlConfigurer navigationAccessControlConfigurer() {
  *     return new NavigationAccessControlConfigurer()
  *             .withRoutePathAccessChecker().withLoginView(LoginView.class);
@@ -70,7 +71,8 @@
  * prevent cyclic dependencies errors.
  *
  * 
- * {@code @Bean
+ * {@code
+ * @Bean
  * class SecurityConfig extends VaadinWebSecurity {
  *     static NavigationAccessControlConfigurer navigationAccessControlConfigurer() {
  *         return new NavigationAccessControlConfigurer()
diff --git a/vaadin-spring/src/main/java/com/vaadin/flow/spring/security/SpringAccessPathChecker.java b/vaadin-spring/src/main/java/com/vaadin/flow/spring/security/SpringAccessPathChecker.java
index 34433919a04..19e56925de6 100644
--- a/vaadin-spring/src/main/java/com/vaadin/flow/spring/security/SpringAccessPathChecker.java
+++ b/vaadin-spring/src/main/java/com/vaadin/flow/spring/security/SpringAccessPathChecker.java
@@ -42,7 +42,8 @@
  * method.
  *
  * 
- * {@code @Bean
+ * {@code
+ * @Bean
  * NavigationAccessControlConfigurer navigationAccessControlConfigurer() {
  *     return new NavigationAccessControlConfigurer()
  *             .withRoutePathAccessChecker().withLoginView(LoginView.class);