8294608: Remove redundant unchecked suppression in FileDescriptor

Reviewed-by: alanb, bpb
This commit is contained in:
Andrey Turbanov 2022-09-30 20:19:45 +00:00
parent d207da8a8c
commit 375f02fb21

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -227,7 +227,6 @@ public final class FileDescriptor {
* The {@link #registerCleanup} method should be called for new fds.
* @param fd the raw fd or -1 to indicate closed
*/
@SuppressWarnings("unchecked")
synchronized void set(int fd) {
if (fd == -1 && cleanup != null) {
cleanup.clear();
@ -243,7 +242,6 @@ public final class FileDescriptor {
* The {@link #registerCleanup} method should be called for new handles.
* @param handle the handle or -1 to indicate closed
*/
@SuppressWarnings("unchecked")
void setHandle(long handle) {
if (handle == -1 && cleanup != null) {
cleanup.clear();
@ -258,7 +256,6 @@ public final class FileDescriptor {
* The cleanup should be registered after the handle is set in the FileDescriptor.
* @param cleanable a PhantomCleanable to register
*/
@SuppressWarnings("unchecked")
synchronized void registerCleanup(PhantomCleanable<FileDescriptor> cleanable) {
Objects.requireNonNull(cleanable, "cleanable");
if (cleanup != null) {
@ -291,7 +288,6 @@ public final class FileDescriptor {
* Package private to allow it to be used in java.io.
* @throws IOException if close fails
*/
@SuppressWarnings("unchecked")
synchronized void close() throws IOException {
unregisterCleanup();
close0();