diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/JndiPropertiesHidingClassLoader.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/JndiPropertiesHidingClassLoader.java index 991276374d0..97fb0f9b32a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/JndiPropertiesHidingClassLoader.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jndi/JndiPropertiesHidingClassLoader.java @@ -36,7 +36,7 @@ public class JndiPropertiesHidingClassLoader extends ClassLoader { @Override public Enumeration getResources(String name) throws IOException { if ("jndi.properties".equals(name)) { - return Collections.enumeration(Collections.emptyList()); + return Collections.emptyEnumeration(); } return super.getResources(name); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java index bf5136c2381..e1c860d0c23 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/archive/ExplodedArchive.java @@ -173,7 +173,7 @@ public class ExplodedArchive implements Archive { private Iterator listFiles(File file) { File[] files = file.listFiles(); if (files == null) { - return Collections.emptyList().iterator(); + return Collections.emptyIterator(); } Arrays.sort(files, this.entryComparator); return Arrays.asList(files).iterator(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java index 30c2480b713..d4be91bfe11 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/servlet/support/SpringBootServletInitializerTests.java @@ -129,7 +129,7 @@ class SpringBootServletInitializerTests { given(servletContext.getInitParameterNames()) .willReturn(Collections.enumeration(Collections.singletonList("spring.profiles.active"))); given(servletContext.getInitParameter("spring.profiles.active")).willReturn("from-servlet-context"); - given(servletContext.getAttributeNames()).willReturn(Collections.enumeration(Collections.emptyList())); + given(servletContext.getAttributeNames()).willReturn(Collections.emptyEnumeration()); try (ConfigurableApplicationContext context = (ConfigurableApplicationContext) new PropertySourceVerifyingSpringBootServletInitializer() .createRootApplicationContext(servletContext)) { assertThat(context.getEnvironment().getActiveProfiles()).containsExactly("from-servlet-context");