RFR: 8282241: Invalid generic signature for redefined classes

Coleen Phillimore coleenp at openjdk.java.net
Thu Mar 3 23:09:59 UTC 2022


On Thu, 3 Mar 2022 15:07:05 GMT, Alex Menkov <amenkov at openjdk.org> wrote:

> JDK-8238048 (fixed in jdk15) moved major_version, minor_version, generic_signature_index and source_file_name_index from InstanceKlass to ConstantPool.
> We still have some incorrect code in CP merge during class redefinition.
> 
> rewrite_cp_refs(scratch_class) updates generic_signature_index and source_file_name_index in the scratch_cp, so we need to copy the attributes (merge_cp->copy_fields(scratch_cp())) after rewrite_cp_refs.
> 
> In redefine_single_class we don't need to copy source_file_name_index because it's a CP property and we swap CPs. So this copying actually sets the value from old class.
> 
> tested:
> - test/jdk/java/lang/instrument
> - test/hotspot/jtreg/serviceability/jvmti/RedefineClasses
> - test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses
> - test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses

Thank you for fixing this.  It took me a while to figure this out again and it looks correct.  Can you use the new redefine class test framework for the test instead?

test/jdk/java/lang/instrument/RetransformGenericSignatureTest.java line 1:

> 1: /*

Can you write this test in the framework where the newer RedefineClasses test are in test/hotspot/jtreg/serviceability/jvmti/RedefineClasses ?  You can just write the new class as a string that the inMemory compiler compiles for you.  It's a lot simpler and doesn't use a shell script at all.

-------------

Changes requested by coleenp (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/7676


More information about the serviceability-dev mailing list