This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Question on resolving generics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question on resolving generics" Watch "Question on resolving generics" New topic
Author

Question on resolving generics

Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 387

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

Joined: Nov 08, 2007
Posts: 457
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.


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 387

Bill,

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

Regards.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on resolving generics