<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4"><font face="monospace">Received on the -comments
list, on the subject of unnamed locals in TWR. </font></font><br>
<div class="moz-forward-container"><br>
<br>
-------- Forwarded Message --------
<table class="moz-email-headers-table" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<th valign="BASELINE" nowrap="nowrap" align="RIGHT">Subject:
</th>
<td>Re: Draft JEP: Unnamed local variables and patterns</td>
</tr>
<tr>
<th valign="BASELINE" nowrap="nowrap" align="RIGHT">Date: </th>
<td>Tue, 18 Oct 2022 06:43:18 +0000</td>
</tr>
<tr>
<th valign="BASELINE" nowrap="nowrap" align="RIGHT">From: </th>
<td>Till Brychcy <a class="moz-txt-link-rfc2396E" href="mailto:till.brychcy@unite.eu"><till.brychcy@unite.eu></a></td>
</tr>
<tr>
<th valign="BASELINE" nowrap="nowrap" align="RIGHT">To: </th>
<td><a class="moz-txt-link-abbreviated" href="mailto:amber-spec-comments@openjdk.org">amber-spec-comments@openjdk.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:amber-spec-comments@openjdk.org"><amber-spec-comments@openjdk.org></a></td>
</tr>
</tbody>
</table>
<br>
<br>
<div>> 7. a resource specification of a try-with-resources
statement<br>
> <br>
> Today we get this warning with a TWR-statement if the local
is ignored:<br>
> <br>
> ><br>
> javac -Xlint:all MyScopedLock.java<br>
> <br>
> MyScopedLock.java:23: warning: [try] auto-closeable
resource ignored is never referenced in body of corresponding
try statement<br>
> try(MyScopedLock ignored = l.lock()) {<br>
> ^<br>
> 1 warning<br>
> <br>
> So here we may have a clash of philosophies for the
enhanced-for and how people<br>
> use the `AutoCloseable`.<br>
<br>
<br>
We have a similar use case: a logging framework that uses the
close() call to measure the runtime of some code block.<br>
<br>
It looks like this:<br>
<br>
try (__ __ = ThreadLogger.block(SomeClass.class, "someAction"))
{<br>
// some code<br>
}<br>
<br>
Note we named the helper class and variable already "__" to make
clear that they are not used - before Java 8 we used to called
them "_“ :-)<br>
<br>
Big advantages in comparison to e.g. a lambda based solution are
that this doesn’t interfere with exceptions and variables
outside the try statement can be assigned.<br>
<br>
There are also more cases reported by other people in
<a class="moz-txt-link-freetext" href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=560733">https://bugs.eclipse.org/bugs/show_bug.cgi?id=560733</a> , which why
an already implemented warning for such variables by Eclipse was
removed again.<br>
<br>
</div>
<div dir="ltr" style="mso-line-height-rule:exactly;-webkit-text-size-adjust:100%;direction:ltr;">
<table style="width:100%;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:0;">
<td style="vertical-align:top;" align="left">
<table style="font-size:0;line-height:normal;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:0;">
<td style="padding:22px 0 0;vertical-align:top;" align="left"><img src="cid:part1.pQENC9OG.d0tpnrs2@oracle.com" alt="" style="font-size:0;" class="" border="0"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="font-size:0;">
<td style="vertical-align:top;" align="left">
<table style="font-size:0;color:#28235C;font-style:normal;font-weight:700;white-space:nowrap;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:10px;">
<td style="padding:33px 0
0;vertical-align:top;font-family:Arial;" align="left">Wir stellen uns als Marke neu auf und stehen mehr denn je zusammen.<span style="font-family:remialcxesans;font-size:1px;color:#FFFFFF;line-height:1px;"></span><br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="font-size:0;">
<td style="vertical-align:top;" align="left">
<table style="font-size:0;color:#28235C;font-style:normal;font-weight:400;white-space:nowrap;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:10px;">
<td style="padding:3px 0
0;vertical-align:top;font-family:Arial;" align="left">Unite ist nun unsere führende Unternehmensmarke.<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="font-size:0;">
<td style="vertical-align:top;" align="left">
<table style="font-size:0;color:#FB563E;font-style:normal;font-weight:400;white-space:nowrap;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:10px;">
<td style="padding:4px 0
0;vertical-align:top;font-family:Arial;" align="left"><a href="https://we.unite.eu/de/" target="_blank" id="LPlnk689713" title="we.unite.eu" style="text-decoration:none;color:#FB563E;" moz-do-not-send="true"><strong style="font-weight:400;">Erfahren Sie mehr</strong></a><br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="font-size:0;">
<td style="vertical-align:top;" align="left">
<table style="font-size:0;color:#28235C;font-style:normal;font-weight:400;white-space:nowrap;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:10px;">
<td style="padding:11px 0
0;vertical-align:top;font-family:Arial;" align="left">Folgen Sie uns auf <a href="https://www.linkedin.com/company/unite-network" target="_blank" id="LPlnk689713" style="text-decoration:none;color:#28235C;" moz-do-not-send="true"><strong style="font-weight:400;">LinkedIn</strong></a>, <a href="https://twitter.com/weunite_global" target="_blank" id="LPlnk689713" style="text-decoration:none;color:#28235C;" moz-do-not-send="true"><strong style="font-weight:400;">Twitter</strong></a> oder <a href="https://www.youtube.com/c/uniteglobal" target="_blank" id="LPlnk689713" style="text-decoration:none;color:#28235C;" moz-do-not-send="true"><strong style="font-weight:400;">YouTube</strong></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="font-size:0;">
<td style="vertical-align:top;" align="left">
<table style="font-size:0;color:#FB563E;font-style:normal;font-weight:400;white-space:nowrap;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:14px;">
<td style="padding:28px 0
0;vertical-align:top;font-family:'Century
Gothic';" align="left"><a href="http://unite.eu/" target="_blank" id="LPlnk689713" title="unite.eu" style="text-decoration:none;color:#FB563E;" moz-do-not-send="true"><strong style="font-weight:400;">unite.eu</strong></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="font-size:0;">
<td style="vertical-align:top;" align="left">
<table style="font-size:0;color:#28235C;font-style:normal;font-weight:400;white-space:nowrap;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:10px;">
<td style="padding:25px 0
0;vertical-align:top;font-family:Arial;" align="left">Unite Services GmbH & Co. KG, im Auftrag von Unite<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="font-size:0;">
<td style="vertical-align:top;" align="left">
<table style="font-size:0;color:#28235C;font-style:normal;font-weight:700;white-space:nowrap;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:10px;">
<td style="padding:12px 0
0;vertical-align:top;font-family:Arial;" align="left">Unite Network SE<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="font-size:0;">
<td style="vertical-align:top;" align="left">
<table style="font-size:0;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:0;">
<td style="padding:4px 0 0;vertical-align:top;" align="left">
<table style="white-space:nowrap;color:#28235C;font-size:14.67px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:13.33px;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:10px;">
<td style="font-family:adobe-clean,sans-serif;">Neumarkt 9, 04109 Leipzig, Deutschland | Amtsgericht Leipzig, HRB 39278<br>
Vorstand: Dr. Sebastian Wieser (Vorsitzender), Christel Constant, Peter Ledermann, Dr. Bernd Schönwälder<br>
Aufsichtsrat: Karl Mayer‑Rieckh (Vorsitzender)<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="font-size:0;">
<td style="vertical-align:top;" align="left">
<table style="font-size:0;color:#28235C;font-style:normal;font-weight:700;white-space:nowrap;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:10px;">
<td style="padding:12px 0
0;vertical-align:top;font-family:Arial;" align="left">Mercateo Deutschland AG</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="font-size:0;">
<td style="vertical-align:top;" align="left">
<table style="white-space:nowrap;color:#28235C;font-size:14.67px;font-family:Arial;font-weight:400;font-style:normal;text-align:left;line-height:13.33px;" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr style="font-size:10px;">
<td style="font-family:Arial;">Mercateo Deutschland AG Fürstenfelder Straße 5, 80331 München, Deutschland | Amtsgericht München, HRB 243681<br>
Vorstand: Dr. Sebastian Wieser (Vorsitzender), Christel Constant, Peter Ledermann, Dr. Bernd Schönwälder<br>
Aufsichtsrat: Karl Mayer‑Rieckh (Vorsitzender)<br>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr style="color:#FB563E;font-size:10px;font-style:normal;font-weight:400;white-space:nowrap;">
<td style="vertical-align:top;font-family:Arial;" align="left"><a href="https://www.mercateo.com/procure/" target="_blank" id="LPlnk689713" style="text-decoration:none;color:#FB563E;" moz-do-not-send="true"><strong style="font-weight:400;">mercateo.com/procure</strong></a></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>