--- a/src/hotspot/share/classfile/defaultMethods.cpp Wed Apr 04 18:19:46 2018 -0400
+++ b/src/hotspot/share/classfile/defaultMethods.cpp Thu Apr 05 13:19:25 2018 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -884,6 +884,10 @@
if (new_methods->length() > 0) {
ConstantPool* cp = bpool->create_constant_pool(CHECK);
if (cp != klass->constants()) {
+ // Copy resolved anonymous class into new constant pool.
+ if (klass->is_anonymous()) {
+ cp->klass_at_put(klass->this_class_index(), klass);
+ }
klass->class_loader_data()->add_to_deallocate_list(klass->constants());
klass->set_constants(cp);
cp->set_pool_holder(klass);