Skip to content

Commit

Permalink
chore: Format for Java 17 instead of Java 5
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur- committed Oct 8, 2024
1 parent 92c0853 commit 8ed84ab
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 58 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,33 @@ 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
* // 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,7 +26,8 @@
* <p>
* Only for read as data is immutable.
*/
public record MenuData(String title, Double order, boolean exclude, String icon, Class<? extends Component> menuClass) implements Serializable {
public record MenuData(String title, Double order, boolean exclude, String icon,
Class<? extends Component> menuClass) implements Serializable {

/**
* MenuData constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ private static VaadinRequest createVaadinRequest(
* the enforcement messages or null if enforcement should not be
* applied
* @param origin
* the exception that caused the enforcement
* the exception that caused the enforcement
* @param endRequestAction
* the action to be run at the end of the request
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,32 @@
/**
* Represents a view configuration for use with a menu.
*
* @param title title of view
* @param rolesAllowed logged in roles allowed for view
* @param loginRequired requires login
* @param route path string
* @param lazy lazy loaded
* @param register register view
* @param menu menu item information
* @param children view children
* @param routeParameters view parameters
* @param flowLayout if server layout should be used
* @param title
* title of view
* @param rolesAllowed
* logged in roles allowed for view
* @param loginRequired
* requires login
* @param route
* path string
* @param lazy
* lazy loaded
* @param register
* register view
* @param menu
* menu item information
* @param children
* view children
* @param routeParameters
* view parameters
* @param flowLayout
* if server layout should be used
*/
public record AvailableViewInfo(String title, String[] rolesAllowed,
boolean loginRequired, String route, boolean lazy,
boolean register, MenuData menu,
List<AvailableViewInfo> children, @JsonProperty(
"params") Map<String, RouteParamType> routeParameters, boolean flowLayout) implements Serializable {
boolean loginRequired, String route, boolean lazy, boolean register,
MenuData menu, List<AvailableViewInfo> children,
@JsonProperty("params") Map<String, RouteParamType> routeParameters,
boolean flowLayout) implements Serializable {

@Override
public boolean equals(final Object o) {
Expand All @@ -67,22 +77,20 @@ public boolean equals(final Object o) {

@Override
public int hashCode() {
int result = Objects.hash(title, loginRequired, route, lazy, register, menu, routeParameters);
int result = Objects.hash(title, loginRequired, route, lazy, register,
menu, routeParameters);
result = 31 * result + Arrays.hashCode(rolesAllowed);
return result;
}

@Override
public String toString() {
return "AvailableViewInfo{" + "title='" + title
+ '\'' + ", rolesAllowed=" + Arrays.toString(rolesAllowed)
+ ", loginRequired=" + loginRequired
+ ", route='" + route + '\''
+ ", lazy=" + lazy
+ ", register=" + register
+ ", menu=" + menu
+ ", flowLayout=" + flowLayout
+ ", routeParameters=" + routeParameters + '}';
return "AvailableViewInfo{" + "title='" + title + '\''
+ ", rolesAllowed=" + Arrays.toString(rolesAllowed)
+ ", loginRequired=" + loginRequired + ", route='" + route
+ '\'' + ", lazy=" + lazy + ", register=" + register + ", menu="
+ menu + ", flowLayout=" + flowLayout + ", routeParameters="
+ routeParameters + '}';
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
* annotation or null if not available. Always null for
* Hilla/TypeScript client views.
*/
public record MenuEntry(String path, String title, Double order,
String icon, Class<? extends Component> menuClass) implements Serializable {
public record MenuEntry(String path, String title, Double order, String icon,
Class<? extends Component> menuClass) implements Serializable {
}
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 @@ -119,7 +119,8 @@ public class FilterableResourceResolver
private List<String> blockedJarsList;

private record PackageInfo(Set<String> allowedPackages,
Set<String> blockedPackages, boolean blockedJar) implements Serializable {
Set<String> blockedPackages,
boolean blockedJar) implements Serializable {
}

/**
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 8ed84ab

Please sign in to comment.