chore: remove reflective workaround for accessing ClassLoader
@@ -939,20 +939,7 @@ public class JavaCompilationUnitExtractor {
private static class MaskedClassLoader extends ClassLoader {
private MaskedClassLoader() {
// delegate only to the bootclasspath
- super(getPlatformClassLoader());
- }
-
- // TODO(#2451): remove reflection and call ClassLoader.getPlatformClassLoader() directly
- // once JDK 8 compatibility is no longer required.
- public static ClassLoader getPlatformClassLoader() {
- try {
- // In JDK 9, all platform classes are visible to the platform class loader:
- // https://docs.oracle.com/javase/9/docs/api/java/lang/ClassLoader.html#getPlatformClassLoader--
- return (ClassLoader) ClassLoader.class.getMethod("getPlatformClassLoader").invoke(null);
- } catch (ReflectiveOperationException e) {
- // In earlier releases, set 'null' as the parent to delegate to the boot class loader.
- return null;
- }
+ super(ClassLoader.getPlatformClassLoader());
}
@Override
