Re: RFR: 8263233: Update java.net and java.nio to use instanceof pattern variable [v2]
On Tue, 9 Mar 2021 13:01:10 GMT, Michael McMahon wrote: >> src/java.base/share/classes/java/net/InterfaceAddress.java line 107: >> >>> 105: >>> 106: if (Objects.equals(address, cmp.address) && >>> 107: Objects.equals(broadcast, cmp.broadcast) && >> >> This could be simplified to: >> >> public boolean equals(Object obj) { >> if (obj instanceof InterfaceAddress cmp >> && Objects.equals(address, cmp.address) >> && Objects.equals(broadcast, cmp.broadcast) >> && maskLength == cmp.maskLength) { >> return true; >> } >> return false; >> } > > or go one step further and replace the if statement just with the boolean > expression. Replaced the if statement with boolean expression as suggested. See eca9095 - PR: https://git.openjdk.java.net/jdk/pull/2890
Re: RFR: 8263233: Update java.net and java.nio to use instanceof pattern variable [v2]
On Tue, 9 Mar 2021 12:44:10 GMT, Alan Bateman wrote: >> Patrick Concannon has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8263233: Small refactor of equals method in java/net/InterfaceAddress; >> removed superfluous whitespace in java/net/Inet6Address > > src/java.base/share/classes/java/net/Inet6Address.java line 265: > >> 263: >> 264: public boolean equals(Object o) { >> 265: if (! (o instanceof Inet6AddressHolder that)) { > > There's a spurious space after "!" can be probably be fixed while you are on > that line. Can do. I've removed the space in commit eca9095 - PR: https://git.openjdk.java.net/jdk/pull/2890
Re: RFR: 8263233: Update java.net and java.nio to use instanceof pattern variable [v2]
On Tue, 9 Mar 2021 17:59:27 GMT, Patrick Concannon wrote: >> Hi, >> >> Could someone please review my code for updating the code in the `java.net` >> and `java.nio` packages to make use of the `instanceof` pattern variable? >> >> Kind regards, >> Patrick > > Patrick Concannon has updated the pull request incrementally with one > additional commit since the last revision: > > 8263233: Small refactor of equals method in java/net/InterfaceAddress; > removed superfluous whitespace in java/net/Inet6Address Looks fine. - Marked as reviewed by bpb (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/2890
Re: RFR: 8263233: Update java.net and java.nio to use instanceof pattern variable [v2]
> Hi, > > Could someone please review my code for updating the code in the `java.net` > and `java.nio` packages to make use of the `instanceof` pattern variable? > > Kind regards, > Patrick Patrick Concannon has updated the pull request incrementally with one additional commit since the last revision: 8263233: Small refactor of equals method in java/net/InterfaceAddress; removed superfluous whitespace in java/net/Inet6Address - Changes: - all: https://git.openjdk.java.net/jdk/pull/2890/files - new: https://git.openjdk.java.net/jdk/pull/2890/files/b204a44a..eca90955 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk=2890=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk=2890=00-01 Stats: 8 lines in 2 files changed: 0 ins; 4 del; 4 mod Patch: https://git.openjdk.java.net/jdk/pull/2890.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/2890/head:pull/2890 PR: https://git.openjdk.java.net/jdk/pull/2890