RFR: 8292140: (fs) Confusing instanceof check in RegistryFileTypeDetector
Andrey Turbanov
aturbanov at openjdk.org
Tue Aug 9 20:58:12 UTC 2022
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
-------------
Commit messages:
- [PATCH] Confusing instanceof check in RegistryFileTypeDetector
Changes: https://git.openjdk.org/jdk/pull/9797/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9797&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8292140
Stats: 5 lines in 1 file changed: 0 ins; 3 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/9797.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/9797/head:pull/9797
PR: https://git.openjdk.org/jdk/pull/9797
More information about the nio-dev
mailing list