On Thu, 26 May 2022 15:25:32 GMT, Ioi Lam <ik...@openjdk.org> wrote: >> Maxim Kartashev has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Removed unnecessary null checks > > src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemFactory.java > line 113: > >> 111: CgroupInfo anyController = infos.values().iterator().next(); >> 112: CgroupSubsystem subsystem = >> CgroupV2Subsystem.getInstance(anyController); >> 113: return new CgroupMetrics(subsystem); > > Should add `Objects.requireNonNull(anyController)` and > `Objects.requireNonNull(subsystem)`.
I added the first, but not the second as that looks like an overkill; see the definition of the constructor: CgroupMetrics(CgroupSubsystem subsystem) { this.subsystem = Objects.requireNonNull(subsystem); } ------------- PR: https://git.openjdk.java.net/jdk/pull/8803