Skip to content

Commit

Permalink
chore: Format for Java 17 instead of Java 5 (#20185) (CP: 24.4) (#20469)
Browse files Browse the repository at this point in the history
* chore: Format for Java 17 instead of Java 5 (#20185) (CP: 24.4)

* format HasValidator.java

---------

Co-authored-by: Teppo Kurki <[email protected]>
  • Loading branch information
Artur- and tepi authored Nov 14, 2024
1 parent 9ae1e5f commit 8f7483c
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 30 deletions.
6 changes: 3 additions & 3 deletions eclipse/VaadinJavaConventions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.compiler.source" value="1.5"/>
<setting id="org.eclipse.jdt.core.compiler.source" value="17"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
Expand Down Expand Up @@ -167,7 +167,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.5"/>
<setting id="org.eclipse.jdt.core.compiler.compliance" value="17"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
Expand Down Expand Up @@ -242,7 +242,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.5"/>
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="17"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,31 @@ default Validator<V> getDefaultValidator() {
* public class DatePickerDemo implements HasValidator&lt;LocalDate&gt; {
*
* // 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 <code>clientSideValid</code> 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.
* *&#47;
* * Note how <code>clientSideValid</code> 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.
* *&#47;
* &#64;Override
* public Validator getDefaultValidator() {
* return (value, valueContext) -&gt; clientSideValid ? ValidationResult.ok()
* return (value, valueContext) -&gt; clientSideValid
* ? ValidationResult.ok()
* : ValidationResult.error("Invalid date format");
* }
*
* private final Collection&lt;ValidationStatusChangeListener&lt;LocalDate&gt;&gt;
* validationStatusListeners = new ArrayList&lt;&gt;();
* private final Collection&lt;ValidationStatusChangeListener&lt;LocalDate&gt;&gt; validationStatusListeners = new ArrayList&lt;&gt;();
*
* /**
* * This enables the binding to subscribe for the validation status
* * change events that are fired by this component and revalidate
* * itself respectively.
* *&#47;
* *&#47;
* &#64;Override
* public Registration addValidationStatusChangeListener(
* ValidationStatusChangeListener&lt;LocalDate&gt; listener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1312,14 +1312,18 @@ public void fetchFromProvider_disablePaging_singleQueryWithLimit() {

@Test
public void fetchFromProvider_maxLimitValue_pagesCalculatedProperly() {
AbstractDataProvider<Item,Object>dataProvider=createDataProvider(42);dataProvider=Mockito.spy(dataProvider);
AbstractDataProvider<Item, Object> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,12 @@ public void testNullLessThanEverything() {

@Test
public void testDateRange() {
RangeValidator<LocalDate>v=RangeValidator.of("Date must be in 2016",LocalDate.of(2016,1,1),LocalDate.of(2016,12,31));
RangeValidator<LocalDate> 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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<NameAndVersion> versions = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
* {@link NavigationAccessControlConfigurer} bean.
*
* <pre>
* {@code @Bean
* {@code
* @Bean
* NavigationAccessControlConfigurer navigationAccessControlConfigurer() {
* return new NavigationAccessControlConfigurer()
* .withRoutePathAccessChecker().withLoginView(LoginView.class);
Expand All @@ -70,7 +71,8 @@
* prevent cyclic dependencies errors.
*
* <pre>
* {@code @Bean
* {@code
* @Bean
* class SecurityConfig extends VaadinWebSecurity {
* static NavigationAccessControlConfigurer navigationAccessControlConfigurer() {
* return new NavigationAccessControlConfigurer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
* method.
*
* <pre>
* {@code @Bean
* {@code
* @Bean
* NavigationAccessControlConfigurer navigationAccessControlConfigurer() {
* return new NavigationAccessControlConfigurer()
* .withRoutePathAccessChecker().withLoginView(LoginView.class);
Expand Down

0 comments on commit 8f7483c

Please sign in to comment.