On Thu, 3 Mar 2022 15:07:05 GMT, Alex Menkov <amen...@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 This pull request has now been integrated. Changeset: f0177395 Author: Alex Menkov <amen...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/f01773956fbc092b00c18392735a020ca05257ed Stats: 212 lines in 2 files changed: 202 ins; 7 del; 3 mod 8282241: Invalid generic signature for redefined classes Reviewed-by: coleenp, sspitsyn ------------- PR: https://git.openjdk.java.net/jdk/pull/7676