In order to write test classes for redefinition, you have to either:
1. use RedefineClassHelper with a String that calls inMemoryJavacompiler,
2. use asm or Classfile API to programmatically provide new bytes for redefinition, or
3. compile an old and new version of the class, and read and modify the bytes of the new class so that it can be used to replace the old class.
With jtreg you can't just provide both versions of the class files because if they have the same name, they'll overwrite each other.
RedefineClassHelper provides a way of doing 1 and 2. We should add 3 so we can use it for some new tests that need jasm files. There are also tests in java/lang/instrument that do #3 that use NamedBuffer.java that could use RedefineClassHelper instead.
1. use RedefineClassHelper with a String that calls inMemoryJavacompiler,
2. use asm or Classfile API to programmatically provide new bytes for redefinition, or
3. compile an old and new version of the class, and read and modify the bytes of the new class so that it can be used to replace the old class.
With jtreg you can't just provide both versions of the class files because if they have the same name, they'll overwrite each other.
RedefineClassHelper provides a way of doing 1 and 2. We should add 3 so we can use it for some new tests that need jasm files. There are also tests in java/lang/instrument that do #3 that use NamedBuffer.java that could use RedefineClassHelper instead.
- links to
-
Review(master) openjdk/jdk/25857