[英]resolveFully doesn't resolve nested references or normal references for Callbacks related PathItem
[英]resolveClass doesn't resolve symbolic references
JLS 说 resolveClass 方法应该验证所有符号链接
该规范允许在何时发生链接活动(以及由于递归,加载)时实现灵活性,前提是 Java 编程语言的语义得到尊重,class 或接口在初始化之前经过完全验证和准备,并且在链接过程中检测到的错误会在程序中的某个点引发,程序在该点采取可能需要链接到 class 或涉及错误的接口的操作。
So I tried to create class T that references another class in the first project and created the second project with a custom class loader loads class T but not load another referenced class.
public class T {
public static AnotherClass field = new AnotherClass();
}
public class AnonClassLoader extends ClassLoader {
public Class findClass(String str) {
byte[] bytes = new byte[0];
try {
bytes = Files.readAllBytes(Paths.get(str));
} catch (IOException e) {
e.printStackTrace();
}
Class<?> aClass = defineClass(null, bytes, 0, bytes.length);
return aClass;
}
public static void main(String[] args) throws IOException, NoSuchMethodException, IllegalAccessException,
InvocationTargetException, InstantiationException, ClassNotFoundException {
AnonClassLoader anonClassLoader = new AnonClassLoader();
Class<?> aClass = anonClassLoader.loadClass("/Users/root/IdeaProjects/untitled/T.class", true);
System.out.println(aClass.getName());
}
}
所以我希望尽快得到NoClassDefFound,但实际结果——没有抛出任何错误,class成功解决
因此,根据错误 ID: JDK-8057777 Cleanup of old and used VM interfaces ,热点中没有 static 解析。
同时,在hotspot jdk 8 native function中没有实现
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.