Merge pull request #18754 from dreis2211

* pr/18754:
  Remove redundant explicit types

Closes gh-18754
pull/18769/head
Stephane Nicoll 5 years ago
commit 95270db7ab

@ -85,7 +85,7 @@ class AutoConfiguredHealthEndpointGroups implements HealthEndpointGroups {
private Map<String, HealthEndpointGroup> createGroups(Map<String, Group> groupProperties, BeanFactory beanFactory,
StatusAggregator defaultStatusAggregator, HttpCodeStatusMapper defaultHttpCodeStatusMapper,
Show defaultShowComponents, Show defaultShowDetails, Set<String> defaultRoles) {
Map<String, HealthEndpointGroup> groups = new LinkedHashMap<String, HealthEndpointGroup>();
Map<String, HealthEndpointGroup> groups = new LinkedHashMap<>();
groupProperties.forEach((groupName, group) -> {
Status status = group.getStatus();
Show showComponents = (group.getShowComponents() != null) ? group.getShowComponents()

@ -43,7 +43,7 @@ class HealthAggregatorStatusAggregatorAdapter implements StatusAggregator {
@Override
public Status getAggregateStatus(Set<Status> statuses) {
int index = 0;
Map<String, Health> healths = new LinkedHashMap<String, Health>();
Map<String, Health> healths = new LinkedHashMap<>();
for (Status status : statuses) {
index++;
healths.put("health" + index, asHealth(status));

@ -67,7 +67,7 @@ class HealthContributorRegistryHealthIndicatorRegistryAdapter implements HealthI
@Override
public Map<String, HealthIndicator> getAll() {
Map<String, HealthIndicator> all = new LinkedHashMap<String, HealthIndicator>();
Map<String, HealthIndicator> all = new LinkedHashMap<>();
for (NamedContributor<?> namedContributor : this.contributorRegistry) {
if (namedContributor.getContributor() instanceof HealthIndicator) {
all.put(namedContributor.getName(), (HealthIndicator) namedContributor.getContributor());

@ -37,7 +37,7 @@ public class HealthIndicatorProperties {
private List<String> order = new ArrayList<>();
private final Map<String, Integer> httpMapping = new LinkedHashMap<String, Integer>();
private final Map<String, Integer> httpMapping = new LinkedHashMap<>();
@DeprecatedConfigurationProperty(replacement = "management.endpoint.health.status.order")
public List<String> getOrder() {

@ -80,7 +80,7 @@ abstract class HealthEndpointSupport<C, T> {
Object contributor = getContributor(path, pathOffset);
T health = getContribution(apiVersion, group, contributor, showComponents, showDetails,
isSystemHealth ? this.groups.getNames() : null);
return (health != null) ? new HealthResult<T>(health, group) : null;
return (health != null) ? new HealthResult<>(health, group) : null;
}
@SuppressWarnings("unchecked")

@ -66,7 +66,7 @@ public class SimpleHttpCodeStatusMapper implements HttpCodeStatusMapper {
}
private static Map<String, Integer> getUniformMappings(Map<String, Integer> mappings) {
Map<String, Integer> result = new LinkedHashMap<String, Integer>();
Map<String, Integer> result = new LinkedHashMap<>();
for (Map.Entry<String, Integer> entry : mappings.entrySet()) {
String code = getUniformCode(entry.getKey());
if (code != null) {

@ -38,7 +38,7 @@ public class SimpleStatusAggregator implements StatusAggregator {
private static final List<String> DEFAULT_ORDER;
static {
List<String> defaultOrder = new ArrayList<String>();
List<String> defaultOrder = new ArrayList<>();
defaultOrder.add(Status.DOWN.getCode());
defaultOrder.add(Status.OUT_OF_SERVICE.getCode());
defaultOrder.add(Status.UP.getCode());

@ -177,8 +177,7 @@ class HealthEndpointWebIntegrationTests {
ReactiveHealthContributorRegistry reactiveHealthContributorRegistry(
Map<String, HealthContributor> healthContributorBeans,
Map<String, ReactiveHealthContributor> reactiveHealthContributorBeans) {
Map<String, ReactiveHealthContributor> allIndicators = new LinkedHashMap<String, ReactiveHealthContributor>(
reactiveHealthContributorBeans);
Map<String, ReactiveHealthContributor> allIndicators = new LinkedHashMap<>(reactiveHealthContributorBeans);
healthContributorBeans.forEach((name, contributor) -> allIndicators.computeIfAbsent(name,
(key) -> ReactiveHealthContributor.adapt(contributor)));
return new DefaultReactiveHealthContributorRegistry(allIndicators);

@ -91,7 +91,7 @@ class NamedContributorsMapAdapterTests {
}
private TestNamedContributorsMapAdapter<String> createAdapter() {
Map<String, String> map = new LinkedHashMap<String, String>();
Map<String, String> map = new LinkedHashMap<>();
map.put("one", "one");
map.put("two", "two");
TestNamedContributorsMapAdapter<String> adapter = new TestNamedContributorsMapAdapter<>(map, this::reverse);

@ -96,7 +96,7 @@ public class BasicErrorController extends AbstractErrorController {
public ResponseEntity<Map<String, Object>> error(HttpServletRequest request) {
HttpStatus status = getStatus(request);
if (status == HttpStatus.NO_CONTENT) {
return new ResponseEntity<Map<String, Object>>(status);
return new ResponseEntity<>(status);
}
Map<String, Object> body = getErrorAttributes(request, isIncludeStackTrace(request, MediaType.ALL));
return new ResponseEntity<>(body, status);

@ -55,7 +55,7 @@ abstract class LenientObjectToEnumConverterFactory<T> implements ConverterFactor
enumType = enumType.getSuperclass();
}
Assert.notNull(enumType, () -> "The target type " + targetType.getName() + " does not refer to an enum");
return new LenientToEnumConverter<E>((Class<E>) enumType);
return new LenientToEnumConverter<>((Class<E>) enumType);
}
@SuppressWarnings("unchecked")

Loading…
Cancel
Save