Skip to content

Commit a42d474

Browse files
committed
Remove unnecessary reflection
1 parent a1ba64c commit a42d474

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ClasspathAlignmentChecker.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import org.jspecify.annotations.Nullable;
2424
import org.junit.platform.commons.JUnitException;
25-
import org.junit.platform.commons.support.ReflectionSupport;
2625
import org.junit.platform.commons.util.ClassLoaderUtils;
2726

2827
/**
@@ -51,11 +50,7 @@ class ClasspathAlignmentChecker {
5150

5251
static Optional<JUnitException> check(LinkageError error) {
5352
ClassLoader classLoader = ClassLoaderUtils.getClassLoader(ClasspathAlignmentChecker.class);
54-
Function<String, Package> packageLookup = name -> ReflectionSupport.findMethod(ClassLoader.class,
55-
"getDefinedPackage", String.class) //
56-
.map(m -> (Package) ReflectionSupport.invokeMethod(m, classLoader, name)) //
57-
.orElseGet(() -> getPackage(name));
58-
return check(error, packageLookup);
53+
return check(error, classLoader::getDefinedPackage);
5954
}
6055

6156
// VisibleForTesting

0 commit comments

Comments
 (0)