From bc5863df8d7be2acf331dc8f4b8db3de1e0be2a9 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Wed, 13 Dec 2017 12:30:16 +0100 Subject: [PATCH] Do not attempt to clear ResourceManager's cache with Java9 Closes gh-10927 --- .../org/springframework/boot/devtools/restart/Restarter.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java index c0cb5fbfdd1..50d3ef91015 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java @@ -46,6 +46,7 @@ import org.springframework.boot.devtools.restart.FailureHandler.Outcome; import org.springframework.boot.devtools.restart.classloader.ClassLoaderFiles; import org.springframework.boot.devtools.restart.classloader.RestartClassLoader; import org.springframework.boot.logging.DeferredLog; +import org.springframework.boot.system.JavaVersion; import org.springframework.cglib.core.ClassNameReader; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.GenericApplicationContext; @@ -338,7 +339,9 @@ public class Restarter { clear(ReflectionUtils.class, "declaredMethodsCache"); clear(AnnotationUtils.class, "findAnnotationCache"); clear(AnnotationUtils.class, "annotatedInterfaceCache"); - clear("com.sun.naming.internal.ResourceManager", "propertiesCache"); + if (!JavaVersion.getJavaVersion().isEqualOrNewerThan(JavaVersion.NINE)) { + clear("com.sun.naming.internal.ResourceManager", "propertiesCache"); + } } private void clear(String className, String fieldName) {