Use diamond operator where feasible

See gh-31916
This commit is contained in:
Yanming Zhou
2023-12-28 15:25:18 +08:00
committed by Stéphane Nicoll
parent db2c532c07
commit 094479b55f
22 changed files with 54 additions and 35 deletions

View File

@@ -1231,7 +1231,7 @@ public abstract class AbstractAopProxyTests {
}
}
AdvisedSupport pc = new AdvisedSupport(ITestBean.class);
MapAwareMethodInterceptor mami1 = new MapAwareMethodInterceptor(new HashMap<>(), new HashMap<String, String>());
MapAwareMethodInterceptor mami1 = new MapAwareMethodInterceptor(new HashMap<>(), new HashMap<>());
Map<String, String> firstValuesToAdd = new HashMap<>();
firstValuesToAdd.put("test", "");
MapAwareMethodInterceptor mami2 = new MapAwareMethodInterceptor(new HashMap<>(), firstValuesToAdd);

View File

@@ -37,11 +37,12 @@ public class AsyncResultTests {
String value = "val";
final Set<String> values = new HashSet<>(1);
org.springframework.util.concurrent.ListenableFuture<String> future = AsyncResult.forValue(value);
future.addCallback(new org.springframework.util.concurrent.ListenableFutureCallback<String>() {
future.addCallback(new org.springframework.util.concurrent.ListenableFutureCallback<>() {
@Override
public void onSuccess(String result) {
values.add(result);
}
@Override
public void onFailure(Throwable ex) {
throw new AssertionError("Failure callback not expected: " + ex, ex);
@@ -59,11 +60,12 @@ public class AsyncResultTests {
IOException ex = new IOException();
final Set<Throwable> values = new HashSet<>(1);
org.springframework.util.concurrent.ListenableFuture<String> future = AsyncResult.forExecutionException(ex);
future.addCallback(new org.springframework.util.concurrent.ListenableFutureCallback<String>() {
future.addCallback(new org.springframework.util.concurrent.ListenableFutureCallback<>() {
@Override
public void onSuccess(String result) {
throw new AssertionError("Success callback not expected: " + result);
}
@Override
public void onFailure(Throwable ex) {
values.add(ex);

View File

@@ -276,7 +276,7 @@ class ScheduledAnnotationBeanPostProcessorObservabilityTests {
@Scheduled(fixedDelay = 10_000, initialDelay = 5_000)
Mono<String> hasCurrentObservation() {
return Mono.just("test")
.tap(() -> new DefaultSignalListener<String>() {
.tap(() -> new DefaultSignalListener<>() {
@Override
public void doFirst() throws Throwable {
Observation observation = observationRegistry.getCurrentObservation();