Thu, 17 Oct 2013 23:30:17 -0400
8026365: NoClassDefinitionFound for anonymous class invokespecial.
Reviewed-by: dcubed, kamg
src/share/vm/classfile/verifier.cpp | file | annotate | diff | comparison | revisions | |
test/TEST.groups | file | annotate | diff | comparison | revisions |
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(),
2.1 --- a/test/TEST.groups Thu Oct 17 10:58:45 2013 -0700 2.2 +++ b/test/TEST.groups Thu Oct 17 23:30:17 2013 -0400 2.3 @@ -27,7 +27,7 @@ 2.4 # - compact1, compact2, compact3, full JRE, JDK 2.5 # 2.6 # In addition they support testing of the minimal VM on compact1 and compact2. 2.7 -# Essentially this defines groups based around the specified API's and VM 2.8 +# Essentially this defines groups based around the specified API's and VM 2.9 # services available in the runtime. 2.10 # 2.11 # The groups are defined hierarchically in two forms: 2.12 @@ -44,9 +44,9 @@ 2.13 # by listing the top-level test directories. 2.14 # 2.15 # To use a group simply list it on the jtreg command line eg: 2.16 -# jtreg :jdk 2.17 +# jtreg :jdk 2.18 # runs all tests. While 2.19 -# jtreg :compact2 2.20 +# jtreg :compact2 2.21 # runs those tests that only require compact1 and compact2 API's. 2.22 # 2.23 2.24 @@ -69,6 +69,7 @@ 2.25 runtime/7107135/Test7107135.sh \ 2.26 runtime/7158988/FieldMonitor.java \ 2.27 runtime/7194254/Test7194254.java \ 2.28 + runtime/8026365/InvokeSpecialAnonTest.java \ 2.29 runtime/jsig/Test8017498.sh \ 2.30 runtime/Metaspace/FragmentMetaspace.java \ 2.31 runtime/NMT/BaselineWithParameter.java \ 2.32 @@ -140,7 +141,7 @@ 2.33 -:needs_jdk 2.34 2.35 # Tests that require compact2 API's and a full VM 2.36 -# 2.37 +# 2.38 needs_full_vm_compact2 = 2.39 2.40 # Compact 1 adds full VM tests