1.1 --- a/src/share/vm/classfile/verifier.cpp Thu Oct 17 10:58:45 2013 -0700 1.2 +++ b/src/share/vm/classfile/verifier.cpp Thu Oct 17 23:30:17 2013 -0400 1.3 @@ -2439,19 +2439,19 @@ 1.4 && !ref_class_type.equals(current_type()) 1.5 && !ref_class_type.equals(VerificationType::reference_type( 1.6 current_class()->super()->name()))) { 1.7 - bool subtype = ref_class_type.is_assignable_from( 1.8 - current_type(), this, CHECK_VERIFY(this)); 1.9 + bool subtype = false; 1.10 + if (!current_class()->is_anonymous()) { 1.11 + subtype = ref_class_type.is_assignable_from( 1.12 + current_type(), this, CHECK_VERIFY(this)); 1.13 + } else { 1.14 + subtype = ref_class_type.is_assignable_from(VerificationType::reference_type( 1.15 + current_class()->host_klass()->name()), this, CHECK_VERIFY(this)); 1.16 + } 1.17 if (!subtype) { 1.18 - if (current_class()->is_anonymous()) { 1.19 - subtype = ref_class_type.is_assignable_from(VerificationType::reference_type( 1.20 - current_class()->host_klass()->name()), this, CHECK_VERIFY(this)); 1.21 - } 1.22 - if (!subtype) { 1.23 - verify_error(ErrorContext::bad_code(bci), 1.24 - "Bad invokespecial instruction: " 1.25 - "current class isn't assignable to reference class."); 1.26 - return; 1.27 - } 1.28 + verify_error(ErrorContext::bad_code(bci), 1.29 + "Bad invokespecial instruction: " 1.30 + "current class isn't assignable to reference class."); 1.31 + return; 1.32 } 1.33 } 1.34 // Match method descriptor with operand stack 1.35 @@ -2470,17 +2470,13 @@ 1.36 if (!current_class()->is_anonymous()) { 1.37 current_frame->pop_stack(current_type(), CHECK_VERIFY(this)); 1.38 } else { 1.39 - // anonymous class invokespecial calls: either the 1.40 - // operand stack/objectref is a subtype of the current class OR 1.41 - // the objectref is a subtype of the host_klass of the current class 1.42 + // anonymous class invokespecial calls: check if the 1.43 + // objectref is a subtype of the host_klass of the current class 1.44 // to allow an anonymous class to reference methods in the host_klass 1.45 VerificationType top = current_frame->pop_stack(CHECK_VERIFY(this)); 1.46 - bool subtype = current_type().is_assignable_from(top, this, CHECK_VERIFY(this)); 1.47 - if (!subtype) { 1.48 - VerificationType hosttype = 1.49 - VerificationType::reference_type(current_class()->host_klass()->name()); 1.50 - subtype = hosttype.is_assignable_from(top, this, CHECK_VERIFY(this)); 1.51 - } 1.52 + VerificationType hosttype = 1.53 + VerificationType::reference_type(current_class()->host_klass()->name()); 1.54 + bool subtype = hosttype.is_assignable_from(top, this, CHECK_VERIFY(this)); 1.55 if (!subtype) { 1.56 verify_error( ErrorContext::bad_type(current_frame->offset(), 1.57 current_frame->stack_top_ctx(),