RFR: 8292140: (fs) Confusing instanceof check in RegistryFileTypeDetector
Alan Bateman
alanb at openjdk.org
Tue Aug 9 20:58:12 UTC 2022
On Mon, 8 Aug 2022 19:51:39 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> Type of `file` parameter is known to be `Path`. And `instanceof` only checks if it's `null` or not.
> https://github.com/openjdk/jdk/blob/2712bc3f79990f27fe9a624a7a818ba1c2c74b67/src/java.base/windows/classes/sun/nio/fs/RegistryFileTypeDetector.java#L43-L46
> Before `implProbeContentType` method is called, parameter is checked for null in `sun.nio.fs.AbstractFileTypeDetector#probeContentType`. It means null check is redundant too.
>
> https://github.com/openjdk/jdk/blob/eb8b789015c98cb5fe7ba788e71f3f6166884739/src/java.base/share/classes/sun/nio/fs/AbstractFileTypeDetector.java#L72-L75
I think this is a left over from when the parameter was of type FileRef.
-------------
PR: https://git.openjdk.org/jdk/pull/9797
More information about the nio-dev
mailing list