我正在尝试使用反射 API 检索同步方法。
下面给出的示例代码片段:
class ABC {
class XYZ {
synchronized List methodOfXYZ() {
System.out.println("Im in Method");
// do sum stuff
return <Obj-List>;
}
}
}
我得到运行时异常,例如:
java.lang.IllegalAccessException: Class "com.TestReflection" can not access a member of class "com.ABC$XYZ" with modifiers "synchronized".