<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>De: </b>"Kevin Bourrillion" <kevinb@google.com><br><b>À: </b>"Remi Forax" <forax@univ-mlv.fr><br><b>Cc: </b>"daniel smith" <daniel.smith@oracle.com>, "amber-spec-experts" <amber-spec-experts@openjdk.java.net><br><b>Envoyé: </b>Mardi 9 Octobre 2018 21:03:42<br><b>Objet: </b>Re: New JEP: Concise Method Bodies<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr">I do like that feature, but, aren't statics the only things that are <i>already</i> easy to make lazy (holder class)?<br><div>This pattern should already be evangelized heavily today for anyone with Java 8 and up.</div></div></blockquote><div><br></div><div>The holder class is a great pattern until you have a better one (sorry just kidding).<br></div><div><br data-mce-bogus="1"></div><div>The holder class means you create a supplementary class and a class object + metadata in not something very lightweight in memory (and on disc) and you still have to hold a lock the first time you call it (the lock around the static init). If the initialization of the constant has no side effect, we can re-use another mechanism than the lazy initialization of the class, the lazy initialization of the constant of the constant pool aka constant dynamic.</div><div><br data-mce-bogus="1"></div><div>The other advantages of the lazy static final is that it is binary backward compatible with the static final so you can choose if a static final is lazy or not whenever you want at no cost.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Rémi</div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 9, 2018 at 11:50 AM <<a href="mailto:forax@univ-mlv.fr" target="_blank">forax@univ-mlv.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:arial,helvetica,sans-serif;font-size:12pt;color:#000000"><br><br><hr id="m_-3573145721036825631zwchr"><div><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>De: </b>"Kevin Bourrillion" <<a href="mailto:kevinb@google.com" target="_blank">kevinb@google.com</a>><br><b>À: </b>"daniel smith" <<a href="mailto:daniel.smith@oracle.com" target="_blank">daniel.smith@oracle.com</a>><br><b>Cc: </b>"Remi Forax" <<a href="mailto:forax@univ-mlv.fr" target="_blank">forax@univ-mlv.fr</a>>, "amber-spec-experts" <<a href="mailto:amber-spec-experts@openjdk.java.net" target="_blank">amber-spec-experts@openjdk.java.net</a>><br><b>Envoyé: </b>Mardi 9 Octobre 2018 20:48:10<br><b>Objet: </b>Re: New JEP: Concise Method Bodies<br></blockquote></div><div><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Oct 9, 2018 at 11:43 AM Dan Smith <<a href="mailto:daniel.smith@oracle.com" target="_blank">daniel.smith@oracle.com</a>> wrote:<br></div><div dir="ltr"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div>We have a rich API for building Comparators. I would expect most non-legacy implementations of Comparable to implement their 'compareTo' method by delegating to a Comparator.</div></div></div></blockquote><br><div>+100</div><div>To me, this pattern is the strongest use case for the entire feature.</div></div></div></blockquote><br><div>We need the lazy static final feature too.<br></div><br><div>Rémi</div><br></div></div></div></blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="line-height:1.5em;padding-top:10px;margin-top:10px;color:rgb(85,85,85);font-family:sans-serif"><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(213,15,37);padding-top:2px;margin-top:2px">Kevin Bourrillion |</span><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(51,105,232);padding-top:2px;margin-top:2px"> Java Librarian |</span><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(0,153,57);padding-top:2px;margin-top:2px"> Google, Inc. |</span><span style="border-width:2px 0px 0px;border-style:solid;border-color:rgb(238,178,17);padding-top:2px;margin-top:2px"><a href="mailto:kevinb@google.com" target="_blank">kevinb@google.com</a></span><br data-mce-bogus="1"></div></div></div></div></div></div></div><br></blockquote></div></div></body></html>