Skip to content

Commit 35c6b83

Browse files
committed
Merge pull request #10494 from Johnny Lim
* gh-10494: Polish “Remove explicit type arguments” Remove explicit type arguments
2 parents a256602 + 2b426c3 commit 35c6b83

File tree

61 files changed

+129
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+129
-153
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/web/server/ManagementServerFactoryCustomizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public final void customize(T factory) {
6767
// the same place)
6868
webServerFactoryCustomizer.customize(factory);
6969
// Then reset the error pages
70-
factory.setErrorPages(Collections.<ErrorPage>emptySet());
70+
factory.setErrorPages(Collections.emptySet());
7171
// and add the management-specific bits
7272
customize(factory, managementServerProperties, serverProperties);
7373
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/web/servlet/RequestMappingEndpointTests.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import org.springframework.context.annotation.Scope;
3939
import org.springframework.context.annotation.ScopedProxyMode;
4040
import org.springframework.context.support.StaticApplicationContext;
41-
import org.springframework.web.servlet.handler.AbstractHandlerMethodMapping;
4241
import org.springframework.web.servlet.handler.AbstractUrlHandlerMapping;
4342
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
4443

@@ -59,8 +58,7 @@ public void concreteUrlMappings() {
5958
mapping.setUrlMap(Collections.singletonMap("/foo", new Object()));
6059
mapping.setApplicationContext(new StaticApplicationContext());
6160
mapping.initApplicationContext();
62-
this.endpoint.setHandlerMappings(
63-
Collections.<AbstractUrlHandlerMapping>singletonList(mapping));
61+
this.endpoint.setHandlerMappings(Collections.singletonList(mapping));
6462
Map<String, Object> result = this.endpoint.mappings();
6563
assertThat(result).hasSize(1);
6664
@SuppressWarnings("unchecked")
@@ -120,8 +118,7 @@ public void beanMethodMappings() {
120118
@Test
121119
public void concreteMethodMappings() {
122120
WebMvcEndpointHandlerMapping mapping = createHandlerMapping();
123-
this.endpoint.setMethodMappings(
124-
Collections.<AbstractHandlerMethodMapping<?>>singletonList(mapping));
121+
this.endpoint.setMethodMappings(Collections.singletonList(mapping));
125122
Map<String, Object> result = this.endpoint.mappings();
126123
assertThat(result).hasSize(2);
127124
assertThat(result.keySet())

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/ShutdownEndpoint.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
public class ShutdownEndpoint implements ApplicationContextAware {
4040

4141
private static final Map<String, String> NO_CONTEXT_MESSAGE = Collections
42-
.unmodifiableMap(Collections.<String, String>singletonMap("message",
43-
"No context to shutdown."));
42+
.unmodifiableMap(
43+
Collections.singletonMap("message", "No context to shutdown."));
4444

4545
private static final Map<String, String> SHUTDOWN_MESSAGE = Collections
46-
.unmodifiableMap(Collections.<String, String>singletonMap("message",
47-
"Shutting down, bye..."));
46+
.unmodifiableMap(
47+
Collections.singletonMap("message", "Shutting down, bye..."));
4848

4949
private ConfigurableApplicationContext context;
5050

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/context/properties/ConfigurationPropertiesReportEndpoint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private Map<String, Object> safeSerialize(ObjectMapper mapper, Object bean,
154154
return result;
155155
}
156156
catch (Exception ex) {
157-
return new HashMap<>(Collections.<String, Object>singletonMap("error",
157+
return new HashMap<>(Collections.singletonMap("error",
158158
"Cannot serialize '" + prefix + "'"));
159159
}
160160
}

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/AuditEventsEndpointWebIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public AuditEventsWebEndpointExtension auditEventsWebEndpointExtension(
106106

107107
private AuditEvent createEvent(String instant, String principal, String type) {
108108
return new AuditEvent(Date.from(Instant.parse(instant)), principal, type,
109-
Collections.<String, Object>emptyMap());
109+
Collections.emptyMap());
110110
}
111111

112112
}

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/audit/listener/AuditListenerTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ public class AuditListenerTests {
3636
@Test
3737
public void testStoredEvents() {
3838
AuditEventRepository repository = mock(AuditEventRepository.class);
39-
AuditEvent event = new AuditEvent("principal", "type",
40-
Collections.<String, Object>emptyMap());
39+
AuditEvent event = new AuditEvent("principal", "type", Collections.emptyMap());
4140
AuditListener listener = new AuditListener(repository);
4241
listener.onApplicationEvent(new AuditApplicationEvent(event));
4342
verify(repository).add(event);

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/security/AuthorizationAuditListenerTests.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.springframework.boot.actuate.audit.listener.AuditApplicationEvent;
2626
import org.springframework.context.ApplicationEventPublisher;
2727
import org.springframework.security.access.AccessDeniedException;
28-
import org.springframework.security.access.ConfigAttribute;
2928
import org.springframework.security.access.SecurityConfig;
3029
import org.springframework.security.access.event.AbstractAuthorizationEvent;
3130
import org.springframework.security.access.event.AuthenticationCredentialsNotFoundEvent;
@@ -56,8 +55,7 @@ public void init() {
5655
public void testAuthenticationCredentialsNotFound() {
5756
AuditApplicationEvent event = handleAuthorizationEvent(
5857
new AuthenticationCredentialsNotFoundEvent(this,
59-
Collections.<ConfigAttribute>singletonList(
60-
new SecurityConfig("USER")),
58+
Collections.singletonList(new SecurityConfig("USER")),
6159
new AuthenticationCredentialsNotFoundException("Bad user")));
6260
assertThat(event.getAuditEvent().getType())
6361
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
@@ -67,8 +65,7 @@ public void testAuthenticationCredentialsNotFound() {
6765
public void testAuthorizationFailure() {
6866
AuditApplicationEvent event = handleAuthorizationEvent(
6967
new AuthorizationFailureEvent(this,
70-
Collections.<ConfigAttribute>singletonList(
71-
new SecurityConfig("USER")),
68+
Collections.singletonList(new SecurityConfig("USER")),
7269
new UsernamePasswordAuthenticationToken("user", "password"),
7370
new AccessDeniedException("Bad user")));
7471
assertThat(event.getAuditEvent().getType())
@@ -83,8 +80,7 @@ public void testDetailsAreIncludedInAuditEvent() throws Exception {
8380
authentication.setDetails(details);
8481
AuditApplicationEvent event = handleAuthorizationEvent(
8582
new AuthorizationFailureEvent(this,
86-
Collections.<ConfigAttribute>singletonList(
87-
new SecurityConfig("USER")),
83+
Collections.singletonList(new SecurityConfig("USER")),
8884
authentication, new AccessDeniedException("Bad user")));
8985
assertThat(event.getAuditEvent().getType())
9086
.isEqualTo(AuthorizationAuditListener.AUTHORIZATION_FAILURE);

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/InMemoryTraceRepositoryTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public class InMemoryTraceRepositoryTests {
3535
@Test
3636
public void capacityLimited() {
3737
this.repository.setCapacity(2);
38-
this.repository.add(Collections.<String, Object>singletonMap("foo", "bar"));
39-
this.repository.add(Collections.<String, Object>singletonMap("bar", "foo"));
40-
this.repository.add(Collections.<String, Object>singletonMap("bar", "bar"));
38+
this.repository.add(Collections.singletonMap("foo", "bar"));
39+
this.repository.add(Collections.singletonMap("bar", "foo"));
40+
this.repository.add(Collections.singletonMap("bar", "bar"));
4141
List<Trace> traces = this.repository.findAll();
4242
assertThat(traces).hasSize(2);
4343
assertThat(traces.get(0).getInfo().get("bar")).isEqualTo("bar");
@@ -48,9 +48,9 @@ public void capacityLimited() {
4848
public void reverseFalse() {
4949
this.repository.setReverse(false);
5050
this.repository.setCapacity(2);
51-
this.repository.add(Collections.<String, Object>singletonMap("foo", "bar"));
52-
this.repository.add(Collections.<String, Object>singletonMap("bar", "foo"));
53-
this.repository.add(Collections.<String, Object>singletonMap("bar", "bar"));
51+
this.repository.add(Collections.singletonMap("foo", "bar"));
52+
this.repository.add(Collections.singletonMap("bar", "foo"));
53+
this.repository.add(Collections.singletonMap("bar", "bar"));
5454
List<Trace> traces = this.repository.findAll();
5555
assertThat(traces).hasSize(2);
5656
assertThat(traces.get(1).getInfo().get("bar")).isEqualTo("bar");

spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/trace/TraceEndpointTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class TraceEndpointTests {
3333
@Test
3434
public void trace() throws Exception {
3535
TraceRepository repository = new InMemoryTraceRepository();
36-
repository.add(Collections.<String, Object>singletonMap("a", "b"));
36+
repository.add(Collections.singletonMap("a", "b"));
3737
Trace trace = new TraceEndpoint(repository).traces().getTraces().get(0);
3838
assertThat(trace.getInfo().get("a")).isEqualTo("b");
3939
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationPackages.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void registerBeanDefinitions(AnnotationMetadata metadata,
131131

132132
@Override
133133
public Set<Object> determineImports(AnnotationMetadata metadata) {
134-
return Collections.<Object>singleton(new PackageImport(metadata));
134+
return Collections.singleton(new PackageImport(metadata));
135135
}
136136

137137
}

0 commit comments

Comments
 (0)