gpt4 book ai didi

java - JDK的ClassLoaderHelper没有使用

转载 作者:搜寻专家 更新时间:2023-11-01 00:53:55 26 4
gpt4 key购买 nike

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.
*/

它只是从以前的版本中遗留下来的还是只是一个指定的 Helper 类以供将来使用?

编辑

我发现了一个相关的错误(解决方案:未解决)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.

最佳答案

我下载了Java 12源码,发现类变了,增加了常量:

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

并且在ClassLoader中使用:

if (ClassLoaderHelper.allowsQuotedPathElements && ...

所以这个类是不能删除的(而且是为ClassLoader指定Helper类)

关于java - JDK的ClassLoaderHelper没有使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56881441/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com