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 ------------- Commit messages: - JDK-8282241 Changes: https://git.openjdk.java.net/jdk/pull/7676/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7676&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8282241 Stats: 249 lines in 2 files changed: 239 ins; 7 del; 3 mod Patch: https://git.openjdk.java.net/jdk/pull/7676.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7676/head:pull/7676 PR: https://git.openjdk.java.net/jdk/pull/7676