I m having some problems with a Wicket 1.3 -> Wicket 1.4 migration, but this question could be applied to Java generics overall, too. The migration has caused hundreds of warnings to spring up out of nowhere -- for those unfamiliar with Wicket, many Wicket classes are derived from a common ancestor, which became generified in v1.4 -- and I m not sure what parameters to apply in some cases, mostly assorted forms and tables. I m thinking they could do with <?>
, <Object>
or <Void>
, but I m not sure which.
<?>
seems most appropriate to me, but there are many places where I can t use a wildcard. <Object>
works in all cases, but it makes me uneasy because it s basically writing a wildcard without using the wildcard, which just feels inherently wrong to part of my brain. And using <Void>
was suggested in the Wicket migration guide.
So what is the proper thing to do in this case?
EDIT 2: I think my first edit (now at the bottom of the question) confused people by making it seem like I was just asking about collections of strings. Here are other examples and their warnings:
public class DocumentProcessor extends Form implements DocumentManagement { ...
Form is a raw type. References to generic type Form should be parameterized
AjaxFallbackDefaultDataTable theTable = new AjaxFallbackDefaultDataTable("theTable", cols, dataProvider, recPerPg);
Multiple markers at this line
- Type safety: The constructor AjaxFallbackDefaultDataTable(String, List, ISortableDataProvider, int) belongs to the raw type AjaxFallbackDefaultDataTable. References to generic type AjaxFallbackDefaultDataTable should be parameterized
- AjaxFallbackDefaultDataTable is a raw type. References to generic type AjaxFallbackDefaultDataTable should be parameterized
- AjaxFallbackDefaultDataTable is a raw type. References to generic type AjaxFallbackDefaultDataTable should be parameterized
EDIT: I was hoping to make the question so broad it didn t need sample code, but here is some.
List<IColumn> columns = new ArrayList<IColumn>();
columns.add(new PropertyColumn(new Model<String>("Number"), "revisionID"));
These warnings are generated:
Multiple markers at [the first] line
- IColumn is a raw type. References to generic type IColumn should be parameterized
- IColumn is a raw type. References to generic type IColumn should be parameterizedMultiple markers at [the second] line
- Type safety: The constructor PropertyColumn(IModel, String) belongs to the raw type PropertyColumn. References to generic type PropertyColumn should be parameterized
- PropertyColumn is a raw type. References to generic type PropertyColumn should be parameterized
There are no errors.