是不是可以形象地比喻为 动态注入 注入内容是类的定义。
defineClass
protected final Class<?> defineClass(String name,
byte[] b,
int off,
int len)
throws ClassFormatError
Converts an array of bytes into an instance of class Class. Before the Class can be used it must be resolved.
This method assigns a default ProtectionDomain to the newly defined class. The ProtectionDomain is effectively granted the same set of permissions returned when Policy.getPolicy().getPermissions(new CodeSource(null, null)) is invoked. The default domain is created on the first invocation of defineClass, and re-used on subsequent invocations.
To assign a specific ProtectionDomain to the class, use the defineClass method that takes a ProtectionDomain as one of its arguments.
字节数组b代表的是类的定义,可以在程序运行时动态注入,如果进一步涉及到平地字节码如何构建的问题,就要像楼上他们说的查阅jvm规范了。