What is the proper way to resolve Eclipse warning "isn't parameterized"?

Posted by Morinar on Stack Overflow See other posts from Stack Overflow or by Morinar
Published on 2010-03-23T17:49:54Z Indexed on 2010/03/23 18:23 UTC
Read the original article Hit count: 363

Filed under:
|
|

I'm trying to clean up some warnings in some old Java code (in Eclipse), and I'm unsure what the proper thing to do is in this case. The block looks more or less like this:

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. */
}

The List generates a warning as it isn't parameterized, however, if I parameterize it with <File>, which I'm pretty sure is what it requires, it complains that it can't convert from Object to List<File>. I could merely suppress the unchecked warning for the function, but would prefer to avoid that if there is a "good" solution. Thoughts?

© Stack Overflow or respective owner

Related posts about java

Related posts about eclipse