There are two similar functions which extract icons on Windows: Java_sun_awt_shell_Win32ShellFolder2_getIcon [1][2] and Java_sun_awt_shell_Win32ShellFolder2_extractIcon [3][4].
The latter corresponds to the new method add in JDK-8182043: FileSystemView.getSystemIcon(File,int,int) [5]. The former is used internally by JFileChooser and by FileSystemView.getSystemIcon(File) [6].
The icons returned by Win32ShellFolder2.getIcon(boolean) are cached. There are some differences but basically both methods do the same thing.
It's worth looking whether it's possible to unify these two methods into one.
[1] https://github.com/openjdk/jdk/blob/7f52c50ba32eecf5f379f8db30ac6a5cc50b3b66/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java#L1052-L1129
[2] https://github.com/openjdk/jdk/blob/94127f43a4a28a89094fa93cd1da49763134f9db/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp#L875-L888
[3] https://github.com/openjdk/jdk/blob/7f52c50ba32eecf5f379f8db30ac6a5cc50b3b66/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java#L1134-L1178
[4] https://github.com/openjdk/jdk/blob/94127f43a4a28a89094fa93cd1da49763134f9db/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp#L960-L994
[5] https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/filechooser/FileSystemView.html#getSystemIcon(java.io.File,int,int)
[6] https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/filechooser/FileSystemView.html#getSystemIcon(java.io.File)