8145371: ClassCastException thrown in LambdaFormEditor.getInCache
Summary: Read field into local to avoid customization race
Reviewed-by: vlivanov, jrose, psandoz
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Mon Jan 08 07:13:27 2018 -0800
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandle.java Wed Jan 03 13:17:35 2018 -0800
@@ -1667,6 +1667,7 @@
/** Craft a LambdaForm customized for this particular MethodHandle */
/*non-public*/
void customize() {
+ final LambdaForm form = this.form;
if (form.customized == null) {
LambdaForm newForm = form.customize(this);
updateForm(newForm);