2回复
2年前
关于ClassLoader的resolveClass方法
有人关注过ClassLoader的resolveClass的实现么?在Java代码中如下:
/**
* Links the specified class. This (misleadingly named) method may be
* used by a class loader to link a class. If the class <tt>c</tt> has
* already been linked, then this method simply returns. Otherwise, the
* class is linked as described in the "Execution" chapter of
* <cite>The Java™ Language Specification</cite>.
*
* @param c
* The class to link
*
* @throws NullPointerException
* If <tt>c</tt> is <tt>null</tt>.
*
* @see #defineClass(String, byte[], int, int)
*/
protected final void resolveClass(Class<?> c) {
resolveClass0(c);
}
然后一路追到虚拟机中
https://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/prims/jvm.cpp
JVM_ENTRY(void, JVM_ResolveClass(JNIEnv* env, jclass cls)) JVMWrapper("JVM_ResolveClass"); if (PrintJVMWarnings) warning("JVM_ResolveClass not implemented"); JVM_END
这里什么也没做啊? 而且我尝试翻了从jdk6到jdk8, 实现都是这样,这和Java代码中的"Links the specified class."是有明显出入的?有哪位大佬对于
这块比较熟悉的?还请赐教,感谢~
944 阅读