问题
I have a method using sun.awt.shell.ShellFolder.get("fileChooserComboBoxFolders");
which I want to replace (or suppress the warning if possible). Can I replace it with anything not Sun properietary so it doesn't throw warnings on some possible removals?
--
UPDATE: not sure if the code is needed at all. It's in a legacy code and I was asked to remove all compile warnings. The one particular with the ShellFolder goes the following:
new Thread {
public void run() {
ShellFolder.get("fileChooserComboBoxFolders");
}
}.start();
--
UPDATE #2 on why it was needed: JFileChooser is still a bit buggy.
回答1:
The only solution to avoid this warning is not to use sun.awt.shell.ShellFolder.get
回答2:
You can suppress warnings by using @SuppressWarnings("all")
before the method you want:
new Thread {
@SuppressWarnings("all")
public void run() {
ShellFolder.get("fileChooserComboBoxFolders"); //No warnings.
}
}.start();
回答3:
AFAIK it fetches the file system root directories (Windows: drive letters) without doing anything with them. This may take a while, hence this might be a speed-up, for the slowness of JFileChooser in older java versions. So remove.
来源:https://stackoverflow.com/questions/17994177/with-what-should-i-replace-sun-awt-shell-shellfolder-so-i-dont-get-compile-warn