Browse Source

Apply "instanceof pattern matching"

pull/29635/head
Sam Brannen 3 years ago
parent
commit
aa1f3d1681
  1. 6
      spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java

6
spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java vendored

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-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.
@ -203,8 +203,8 @@ public class DefaultContextCache implements ContextCache { @@ -203,8 +203,8 @@ public class DefaultContextCache implements ContextCache {
// Physically remove and close leaf nodes first (i.e., on the way back up the
// stack as opposed to prior to the recursive call).
ApplicationContext context = this.contextMap.remove(key);
if (context instanceof ConfigurableApplicationContext) {
((ConfigurableApplicationContext) context).close();
if (context instanceof ConfigurableApplicationContext cac) {
cac.close();
}
removedContexts.add(key);
}

Loading…
Cancel
Save