File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on resolving generics

 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting 2 warnings regarding generics that I cannot resolve. I'm running on Java 6 using Eclipse 3.2.2.

1st warning:

The argument of type String[] should explicitly be cast to Object[] for the invocation of the varargs method format(String, Object...) from type MessageFormat. It could alternatively be cast to Object for a varargs invocation

The warning refers to code in method writeExportLinks() (line 618):



2nd warning:

Type safety: The method put(Object, Object) belongs to the raw type Map. References to generic type Map<K,V> should be parameterized

The warning refers to code in method getOpenTag() (line 632):



ANY help or direction would be greatly appreciated.

Regards.
 
Bill Shirley
Ranch Hand
Posts: 457
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm guessing



is wanted because of the vararg declaration of the method allows
write(String)
or
write(String, Object)
or
write(String, Object, Object)
ad infinitum

also, the declaration of the Map variable should be generically parameterized:


(on the assumption the map is String->String)
if attributeMap is also correctly declared, the clone method will return the correct type.
 
Melinda Savoy
Ranch Hand
Posts: 387
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bill,

Thanks for the reply. I'll give it a shot.

Regards.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic