Skip to content

Commit df6fe91

Browse files
committed
Inline method
1 parent 5802530 commit df6fe91

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

junit-platform-console/src/main/java/org/junit/platform/console/tasks/CustomClassLoaderCloseStrategy.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,13 @@ public enum CustomClassLoaderCloseStrategy {
3131

3232
@Override
3333
public void handle(ClassLoader customClassLoader) {
34-
if (customClassLoader instanceof AutoCloseable closeable) {
35-
close(closeable);
36-
}
37-
}
38-
39-
private void close(AutoCloseable customClassLoader) {
40-
try {
41-
customClassLoader.close();
42-
}
43-
catch (Exception e) {
44-
throw new JUnitException("Failed to close custom class loader", e);
34+
if (customClassLoader instanceof @SuppressWarnings("resource") AutoCloseable closeable) {
35+
try {
36+
closeable.close();
37+
}
38+
catch (Exception ex) {
39+
throw new JUnitException("Failed to close custom class loader", ex);
40+
}
4541
}
4642
}
4743
},
@@ -54,6 +50,7 @@ private void close(AutoCloseable customClassLoader) {
5450
* afterward.
5551
*/
5652
KEEP_OPEN {
53+
5754
@Override
5855
public void handle(ClassLoader customClassLoader) {
5956
// do nothing

0 commit comments

Comments
 (0)