Reputation: 55
class ModelImpl extends Model {
...
CellTable<? extends Model> tableImpl;
...
tableImpl=new CellTable<ModelImpl>();
...
and finally ...
TextColumn<ModelImpl> column = new TextColumn<ModelImpl>() {
@Override
public String getValue(ModelImpl object) {
return object.getColumnValue();
}
};
tableImpl.addColumn(column, "nameColumn");
compiler says:
cannot find symbol method addColumn(com.google.gwt.user.cellview.client.TextColumn < ModelImpl > ,java.lang.String)
but ModelImpl extends Model!! Whats happening?
Upvotes: 1
Views: 585
Reputation: 736
The problem is that you have defined tableImpl
with the type CellTable<? extends Model>
.
? extends Model
means "some specific subclass of Model, but I am not sure what it is".
addColumn
has the signature:
public void addColumn(Column<T,?> col)
The problem is, the you have lost what T
is, because tableImpl is of type CellTable<? extends Model>
. addColumn
only takes a column of the exact same kind of T that the CellTable is parameterized by (in your case ModelImpl). But you have stored your CellTable in a variable that does not know what that exact type is.
So change tableImpl
's definition to look like:
CellTable<ModelImpl> tableImpl;
Upvotes: 4