On Tue, 9 Mar 2021 20:07:14 GMT, Mark Sheppard <mshep...@openjdk.org> wrote:
>> Patrick Concannon has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8263233: Refactored equals method further > > src/java.base/share/classes/java/net/NetMulticastSocket.java line 219: > >> 217: if (addr == null) >> 218: addr = new InetSocketAddress(0); >> 219: if (!(addr instanceof InetSocketAddress epoint)) > > in the context of this type of change the negative logic is a little obtuse > or disjoint in the new style variable declaration, and its subsequent use. > I'd find it a more natural flow and easier to read with the instanceof > pattern prefacing a block in which the variable is used > if (addr instanceof InetSocketAddress epoint) { > // a block which is using the epoint variable > if (epoint.isUnresolved) > throw new SocketException("Unresolved address"); > InetAddress iaddr = epoint.getAddress; > etc, etc ... > } else { > throw new IllegalArgumentException("Unsupported address type!"); > } The disadvantage is that it would add another level of braces. ------------- PR: https://git.openjdk.java.net/jdk/pull/2890