Method md = pattern.structure.proxy.dynamic_proxy.jdk.simulate.Moveable.getClass().getMethod("move"); 错误: 无法从静态上下文中引用非静态 方法 getClass(),这个是怎么回事?
Method[] methodArr = interfaceCls.getMethods(); String methodStr = ""; for (int i = 0; i < methodArr.length; i++) { Method method = methodArr[i]; methodStr += "" + " @Override\n" + " public void " + method.getName() + "() {\n" + " Method md = " + interfaceCls.getName() + ".getClass().getMethod(\"" + method.getName() + "\"); \n" + " h.invoke(this,md);\n" + " }\n"; }
不在一个作用域下吧,环镜不一样