On Wed, 16 Dec 2020 09:44:37 GMT, Chris Hegarty <che...@openjdk.org> wrote:
>> Andrey Turbanov has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8258422: Cleanup unnecessary null comparison before instanceof check in >> java.base >> use instanceof pattern matching in UnixPath too > > Let's take advantage of "flow scoping" to eliminate some of these casts. A > few examples follow. Hi Andrey, Could you, please, also take a look at `java.net.Socket`: java/net/Socket.java: if (bindpoint != null && (!(bindpoint instanceof InetSocketAddress))) java/net/Socket.java- throw new IllegalArgumentException("Unsupported address type"); And `HttpURLConnection`: sun/net/www/protocol/http/HttpURLConnection.java: if (a != null && c instanceof HttpURLConnection) { sun/net/www/protocol/http/HttpURLConnection.java- ((HttpURLConnection)c).setAuthenticator(a); The following cmd was used to find them: `rgrep -A 1 "= null .* instanceof "` ------------- PR: https://git.openjdk.java.net/jdk/pull/20