File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
junit-platform-commons/src/main/java/org/junit/platform/commons/util Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1010
1111package org .junit .platform .commons .util ;
1212
13- import static java .util .stream .StreamSupport .stream ;
14-
1513import java .util .List ;
1614import java .util .ServiceLoader ;
15+ import java .util .ServiceLoader .Provider ;
1716
1817import org .junit .platform .commons .JUnitException ;
1918import org .junit .platform .commons .support .scanning .ClasspathScanner ;
@@ -28,16 +27,17 @@ static ClasspathScanner getInstance() {
2827 ServiceLoader <ClasspathScanner > serviceLoader = ServiceLoader .load (ClasspathScanner .class ,
2928 ClassLoaderUtils .getDefaultClassLoader ());
3029
31- List <ClasspathScanner > classpathScanners = stream ( serviceLoader .spliterator (), false ).toList ();
30+ List <Provider < ClasspathScanner >> classpathScanners = serviceLoader .stream ( ).toList ();
3231
3332 if (classpathScanners .size () == 1 ) {
34- return classpathScanners .get (0 );
33+ return classpathScanners .get (0 ). get () ;
3534 }
3635
3736 if (classpathScanners .size () > 1 ) {
3837 throw new JUnitException (
3938 "There should not be more than one ClasspathScanner implementation present on the classpath but there were %d: %s" .formatted (
40- classpathScanners .size (), classpathScanners ));
39+ classpathScanners .size (),
40+ classpathScanners .stream ().map (Provider ::type ).map (Class ::getName ).toList ()));
4141 }
4242
4343 return new DefaultClasspathScanner (ClassLoaderUtils ::getDefaultClassLoader , ReflectionUtils ::tryToLoadClass );
You can’t perform that action at this time.
0 commit comments