Integrated: 8292140: (fs) Needless instanceof check in RegistryFileTypeDetector

Andrey Turbanov aturbanov at openjdk.org
Thu Aug 11 06:28:40 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

This pull request has now been integrated.

Changeset: ad5f628c
Author:    Andrey Turbanov <aturbanov at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/ad5f628c58c46438f2f542d5255e5fd1fa4d0c6b
Stats:     5 lines in 1 file changed: 0 ins; 3 del; 2 mod

8292140: (fs) Needless instanceof check in RegistryFileTypeDetector

Reviewed-by: alanb

-------------

PR: https://git.openjdk.org/jdk/pull/9797


More information about the nio-dev mailing list