On Wed, 16 Dec 2020 18:27:35 GMT, Aleksei Efimov <[email protected]> wrote:
>> 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 "`
@AlekseiEfimov in both cases removing `null` check will change semantic of the
code. Comparison is not redundant.
-------------
PR: https://git.openjdk.java.net/jdk/pull/20