- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
From this question ,我发现不可能从 sun.misc.DelegatingClassLoader
查找类,即在其自己的类加载器上查找类,例如
Class<?> accessor = ...
accessor.getClassLoader().findClass(accessor.getName());
抛出ClassNotFoundException
。委托(delegate)类加载器用于加载运行时生成的访问器类,以将 Java 的反射 JNI 调用转换为 Java 调用。
出于某种奇怪的原因,我是not able to find the source of the DelegatingClassLoader
anywhere in the JDK sources尽管它在我的构建中显然可用,但从类的字节代码来看,它似乎是标准 ClassLoader
子类的空实现。
如果DelegatingClassLoader
实际上只是一个简单的子类,我不明白为什么不能通过名称查找类。是否涉及一些虚拟机魔法?好像是这样的
private native final Class<?> findLoadedClass0(String name);
方法不会返回 DelegatingClassLoader
加载的类。然而,私有(private)classes
字段确实包含加载的类。
我无法找到有关这些类加载器与任何其他类加载器有何不同的任何信息。我正在寻找解释为什么上述查找不起作用但抛出异常。
最佳答案
DelegatingClassLoader 的源出于某种原因位于 ClassDefiner.java 。有趣的是,这段代码有一个引用 bug 4474172 的注释。 ,这表明 JVM 已知该类加载器并且具有特殊行为:
The second solution is to make the virtual machine "magically" delegate class loading for these newly-fabricated class loaders to their parent loaders, without making an upcall to Java. The disadvantage is that this is another hack in the JVM [...]. This option has been chosen.
关于java - 为什么我无法从 sun.misc.DelegatingClassLoader 查找类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29094310/
我正在使用 Web 服务在 Android 应用程序和 SOAP Web 服务之间发送数据。此 Web 服务仅接受序列化对象,而执行此操作的唯一方法是使用: import sun.misc.BASE6
我正在将 JDK 版本从 8 更新到 11,以解决某些并发数据结构的问题。 error: type Contended is not a member of package sun.misc [ERR
scipy.misc.logsumexp函数的输入参数有(a, axis=None, b=None, keepdims=False, return_sign=False),具体配置可参见这里,返回的
我刚刚安装了 scipy(通过 easy_install scipy),但由于某些原因 scipy.misc 丢失了。 看看这个: >>> import scipy >>> scipy >>> sc
在 kate(或 QtCreator)中,我有一个名为“Fixed[Misc]”的字体。我想检索字体文件,但没有找到:在我的字体目录中,我有一个“misc”目录,但我无法准确找到我在 kate 中使用
我在 python 脚本中导入 scipy.misc 时遇到问题。现在我知道其他人也提出了与此相关的问题,但他们的解决方案对我不起作用。 我正在编写的程序是这样开始的: import matplotl
我一直在使用 sun.misc 中的 BASE64Encoder 和 BASE64Decoder;我正在使用 Eclipse 并且不得不求助于警告,因为默认情况下访问权限仅限于它。 这些类工作得很好,
前言 unsafe类在jdk 源码的多个类中用到,这个类的提供了一些绕开jvm的更底层功能,基于它的实现可以提高效率。但是,它是一把双刃剑:正如它的名字所预示的那样,它是unsafe的,它所分配的
我正在使用具有以下导入的 scipy 1.3.1 运行旧代码: from scipy.misc import bytescale 出现以下错误: ImportError: cannot import
10 分钟前,我尝试连接 phppgadmin 5.1,但我在 Web 服务器错误日志中发现了此错误消息:“Misc 在/usr/share/phppgadmin/classes/Misc.php 第
我想调整表面法线“图像”(H * W * 3)的大小。问题在于数组中存在可取数字。如何使用scipy.misc.resize或cv2.resize调整大小? 最佳答案 cv2.resize支持负数。
jdk1.8.0_144中的src.zip包含Float.java 这又指的是 sun.misc.FloatingDecimal。我在 src.zip 中找不到它?谁能告诉我它在哪里?我可以找到 gr
我正在开发一个供其他团队使用的库,在库中有一些公开的类/方法,但我不希望其他人使用它们。 像java中的sun.misc包这样的东西,虽然所有的类都是公共(public)的,但编译器在使用它时会抛出“
10 分钟前,我尝试连接 phppgadmin 5.1,但我在 Web 服务器错误日志中发现了此错误消息:“Misc 在/usr/share/phppgadmin/classes/Misc.php 第
虽然也有类似的问题(例如 A 、 B 和 C ),但他们的答案并不能解决我的问题。 我使用的是针对 Android API 18 的 Android Studio 1.5.1(Android KitK
我将在我的代码中使用 sun.misc.BASE64Decoder 的 decodeBuffer(String inputString) 。多个线程将在同一个解码器对象上调用此函数。 这个线程安全吗?
我知道 sun.* 包不是官方 Java API 的一部分。但是,我需要使用一些类似于 Perf 提供的功能:特别是基本 JVM 指标(堆、线程、PermGen 等)、GC 的 JvmStat 计数器
我有一个选项卡设置为使用 API8 max 的 Activity 扩展。在此选项卡中,我正在初始化一些 TextView、EditText 和 SeekBar 对象,如下所示。 我正在寻找一种更通用的
sun.misc.Unsafe 或 theUnsafe 实例线程安全吗? 最佳答案 Unsafe 的方法不是线程安全的。您需要像往常一样同步访问您想要自己操作的数据。然而,访问实例 theUnsafe
我想知道我在这里做错了什么...... 我正在试验一个简单而人为的函数,它对某些 x 值求导: f(x) = x^3,然后计算导数 f'(x) = 3x^2 对于 x 在 1、2、3 处的值 >>>
我是一名优秀的程序员,十分优秀!