From d58f33f1cebaaf8caebaec344fa32336fe08ecd6 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Fri, 8 Jul 2022 16:16:53 +0200 Subject: [PATCH] Polish AbstractExposableEndpoint --- .../actuate/endpoint/AbstractExposableEndpoint.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractExposableEndpoint.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractExposableEndpoint.java index e00161c313..333333f01a 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractExposableEndpoint.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractExposableEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,7 @@ package org.springframework.boot.actuate.endpoint; -import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.List; import org.springframework.util.Assert; @@ -34,9 +32,9 @@ public abstract class AbstractExposableEndpoint implements private final EndpointId id; - private boolean enabledByDefault; + private final boolean enabledByDefault; - private List operations; + private final List operations; /** * Create a new {@link AbstractExposableEndpoint} instance. @@ -49,7 +47,7 @@ public abstract class AbstractExposableEndpoint implements Assert.notNull(operations, "Operations must not be null"); this.id = id; this.enabledByDefault = enabledByDefault; - this.operations = Collections.unmodifiableList(new ArrayList<>(operations)); + this.operations = List.copyOf(operations); } @Override