Hi !

I just loaded fortress-web in my favorite IDE, and I have many
compilation errors. One of them :

"The method setObject(Object) of type AuditAuthzListModel<T> must
override or implement a supertype method"

on

    @Override
    public void setObject(Object object)
    {
        log.debug(".setObject count: " + object != null ?
((List<AuthZ>)object).size() : "null");
        this.authZs = (List<AuthZ>) object;
    }

When you build this code, it will compile with no error. Except that...


public class AuditAuthzListModel<T extends Serializable> extends Model


with

public class Model<T extends Serializable> implements IModel<T>


and :

public interface IModel<T> extends IDetachable
{
    void setObject(final T object);
}


The problem is that we are using two different kind of types here : a
generic one (T) and a real one (Object). It does not fit.

At this point, I wonder why is the main class is generic at all ?

What about having  :

public class AuditAuthzListModel extends Model<List<AuthZ>>

Sadly, this can't be done, because List<AuthZ> is not extending
serializable...

So it's clear we are mixing concepts here that don't fit well all
together. I'm quite sure that the class declaration :

public class Model<T extends Serializable> implements IModel (note the
missing <T> after IModel)

and the setObject(Object) declaration are just the way they are to get
rid of the pb with the Model<List<AuthZ>> declaration...


Generics are a PITA...


Reply via email to