English 中文(简体)
解决Eclipse预警“仪表参数”的恰当方式是什么?
原标题:What is the proper way to resolve Eclipse warning "isn t parameterized"?

我试图对一些旧的 Java法(Eclipse)的一些警告进行清理,我不敢肯定在这种情况下应该做些什么。 这块 block体大致如下:

Transferable content = getToolkit().getSystemClipboard().getContents( null );
java.util.List clipboardFileList = null;

if( content.isDataFlavorSupported( DataFlavor.javaFileListFlavor ) ) {
  try {
    clipboardFileList = (java.util.List)content.getTransferData(
      DataFlavor.javaFileListFlavor);
  }
  /* Do other crap, etc. */
}

但是,如果将清单与<代码>和>;File>相距,则清单会产生警告,因为Imttyure是需要的。 目标至<代码>List<File>。 我只能压制对这项职能的无节制警告,但希望避免出现“良好”解决办法。 想法?

最佳回答

我建议将结果明确列入<代码>List<File>并压制警告。 http://java.sun.com/javase/6/docs/api/java/awt/data transfer/DataFlavor.html#javaFileListFlavor”rel=“noreferer”

www.un.org/Depts/DGACM/index_spanish.htm DataFlavor javaFileListFlavor

向 Java(和基本平台)移交一份档案清单,将此类/次类型和代表类别(java.util)的数据库。 清单使用。 清单的每个组成部分都必须/保证为类型java.io.File

在这种情形下,根据Joshuach s

如果你可以取消警告,你可以证明,引起警告的守则是白费,然后(然后)用<条码>@Suppress Warnings(“unchecked”)来压制警告。

问题回答

引言

java.util.List<?>

我不认为你需要使用<条码>和>;?>。 这只是对我课以罚款吗?

Object obj = null;
List<File> aa = (List<File>)obj;




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签