如果方法之前尚未分配给中间变量,是否可以使用 Eclipse 调试器更改/定义方法返回的值?
例如我有一些调用的第三方封闭源代码 java.lang.Class.classForName,看起来像这样
public static Class<?> forName(String className)
throws ClassNotFoundException {
return forName0(className, true, ClassLoader.getCallerClassLoader());
}
通过ClassLoader.getCallerClassLoader()获取的类加载器无法加载类,所以我想尝试是否Thread.currentThread().contextClassLoader更幸运。 所以实际上,我想要这样的东西:
public static Class<?> forName(String className)
throws ClassNotFoundException {
return forName0(className, true, Thread.currentThread().contextClassLoader);
}
这有可能吗?请注意,forName0 是 native 方法。
最佳答案
关于java - 当没有中间变量时,在 Eclipse 调试器中操作返回值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12843093/