JDK的ClassLoaderHelper没有使用

JDK's ClassLoaderHelper has no usage

ClassLoaderHelper没有意义

class ClassLoaderHelper {
    private ClassLoaderHelper() {}
    static File mapAlternativeName(File lib) {
        return null;
    }

我没有发现 mapAlternativeName 的任何用法不能被覆盖(静态)

也评论没有实际意义

/**
 * Returns an alternate path name for the given file
 * such that if the original pathname did not exist, then the
 * file may be located at the alternate location.
 * For most platforms, this behavior is not supported and returns null.
 */

它只是以前版本的遗留物还是只是一个指定的助手class供将来使用?

编辑

我发现了一个相关的错误(解决方案:未解决)JDK-7157665 : Use ClassLoaderHelper for all native library loads

The fix for 7134701 needs to be updated to make the same change for the other code paths where native libraries are loaded: namely - where non-bootstrap classloaders are used and - where System.load() is called

In both those cases an absolute pathname is provided, but (on Mac) we should attempt to load the original file first and on Mac, for compatibility with Apple's jdk 6, we should look for a .jnilib variant if the original name was *.dylib, and it wasn't found.

我下载了Java12源,发现class被改了,添加常量:

/**
 * Indicates, whether PATH env variable is allowed to contain quoted entries.
 */
static final boolean allowsQuotedPathElements = true;

并且在ClassLoader中使用:

if (ClassLoaderHelper.allowsQuotedPathElements && ...

所以这个class不能删除(而且是为ClassLoader指定Helperclass)