778 InstanceKlass* scratch_class) { 779 int i; 780 781 // Check superclasses, or rather their names, since superclasses themselves can be 782 // requested to replace. 783 // Check for NULL superclass first since this might be java.lang.Object 784 if (the_class->super() != scratch_class->super() && 785 (the_class->super() == NULL || scratch_class->super() == NULL || 786 the_class->super()->name() != 787 scratch_class->super()->name())) { 788 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; 789 } 790 791 // Check if the number, names and order of directly implemented interfaces are the same. 792 // I think in principle we should just check if the sets of names of directly implemented 793 // interfaces are the same, i.e. the order of declaration (which, however, if changed in the 794 // .java file, also changes in .class file) should not matter. However, comparing sets is 795 // technically a bit more difficult, and, more importantly, I am not sure at present that the 796 // order of interfaces does not matter on the implementation level, i.e. that the VM does not 797 // rely on it somewhere. 798 Array<Klass*>* k_interfaces = the_class->local_interfaces(); 799 Array<Klass*>* k_new_interfaces = scratch_class->local_interfaces(); 800 int n_intfs = k_interfaces->length(); 801 if (n_intfs != k_new_interfaces->length()) { 802 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; 803 } 804 for (i = 0; i < n_intfs; i++) { 805 if (k_interfaces->at(i)->name() != 806 k_new_interfaces->at(i)->name()) { 807 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; 808 } 809 } 810 811 // Check whether class is in the error init state. 812 if (the_class->is_in_error_state()) { 813 // TBD #5057930: special error code is needed in 1.6 814 return JVMTI_ERROR_INVALID_CLASS; 815 } 816 817 // Check whether the nest-related attributes have been changed. 818 jvmtiError err = check_nest_attributes(the_class, scratch_class); 819 if (err != JVMTI_ERROR_NONE) { | 778 InstanceKlass* scratch_class) { 779 int i; 780 781 // Check superclasses, or rather their names, since superclasses themselves can be 782 // requested to replace. 783 // Check for NULL superclass first since this might be java.lang.Object 784 if (the_class->super() != scratch_class->super() && 785 (the_class->super() == NULL || scratch_class->super() == NULL || 786 the_class->super()->name() != 787 scratch_class->super()->name())) { 788 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; 789 } 790 791 // Check if the number, names and order of directly implemented interfaces are the same. 792 // I think in principle we should just check if the sets of names of directly implemented 793 // interfaces are the same, i.e. the order of declaration (which, however, if changed in the 794 // .java file, also changes in .class file) should not matter. However, comparing sets is 795 // technically a bit more difficult, and, more importantly, I am not sure at present that the 796 // order of interfaces does not matter on the implementation level, i.e. that the VM does not 797 // rely on it somewhere. 798 Array<InstanceKlass*>* k_interfaces = the_class->local_interfaces(); 799 Array<InstanceKlass*>* k_new_interfaces = scratch_class->local_interfaces(); 800 int n_intfs = k_interfaces->length(); 801 if (n_intfs != k_new_interfaces->length()) { 802 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; 803 } 804 for (i = 0; i < n_intfs; i++) { 805 if (k_interfaces->at(i)->name() != 806 k_new_interfaces->at(i)->name()) { 807 return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED; 808 } 809 } 810 811 // Check whether class is in the error init state. 812 if (the_class->is_in_error_state()) { 813 // TBD #5057930: special error code is needed in 1.6 814 return JVMTI_ERROR_INVALID_CLASS; 815 } 816 817 // Check whether the nest-related attributes have been changed. 818 jvmtiError err = check_nest_attributes(the_class, scratch_class); 819 if (err != JVMTI_ERROR_NONE) { |