With what should I replace sun.awt.shell.ShellFolder so I don't get compile warnings?

夙愿已清 提交于 2019-12-11 02:56:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!