【发布时间】:2012-10-07 05:09:55
【问题描述】:
Instrumentation.redefineClasses(ClassDefinition[]) 方法的 Java Platform SE 5 API 规范告诉:
重新定义可能会改变方法体、常量池和 属性。重新定义不得添加、删除或重命名字段或 方法、更改方法的签名或更改继承。
attributes 是什么意思?我想它可以是访问修饰符(私有、公共、...)、同步、最终和其他修饰符。但是如果我尝试不仅重新定义方法体,还重新定义它的访问修饰符,或类的访问修饰符,或者尝试使方法同步,我有
java.lang.UnsupportedOperationException: class redefinition failed: attempted to change method modifiers
at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
at sun.instrument.InstrumentationImpl.redefineClasses(Unknown Source)
那么在这种情况下attributes 是什么?
【问题讨论】:
标签: java transformation instrumentation redefine