RFR: 8312444: Delete unused parameters and variables in SocketPermission

Andrey Turbanov aturbanov at openjdk.org
Sat Mar 2 13:05:51 UTC 2024


On Fri, 1 Mar 2024 17:35:35 GMT, Korov <duke at openjdk.org> wrote:

> Removing unused parameter `defval` in `SocketPermission.initEphemeralPorts`, so the variable `PRIV_PORT_MAX` and `DEF_EPH_LOW` unused too.
> 
> Removing unused parameter `cname` in `SocketPermission.authorizedIPv4` and `SocketPermission.authorizedIPv6`.
> 
> Parameter 'action' must be not empty so `a.length > 0`, the check `a.length - 1 < 0` can be removed.

Let's align declaration of `java.net.SocketPermission#NONE` field

Can we drop `java.net.SocketPermission#defaultDeny` field? It seems it's always has `false` value (`setDeny` is never called)

src/java.base/share/classes/java/net/SocketPermission.java line 707:

> 705:     }
> 706: 
> 707:     private boolean authorized(String cname, byte[] addr) {

now `cname` parameter is unused in this method

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18086#issuecomment-1974791236
PR Comment: https://git.openjdk.org/jdk/pull/18086#issuecomment-1974791645
PR Review Comment: https://git.openjdk.org/jdk/pull/18086#discussion_r1509962901



More information about the security-dev mailing list