Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] generic return method in aspcet J

I have an error in ExtendProduct aspect on method getTarget(). I give the code below
Does somebody have an idea?
This error is :
can't override Link<Revision> AssociationSource<Revision>.getTarget() with Link<T> AssociationSource.getTarget() return types don't match

Moreover, one advice having a generic type of return gives a similar error.
Was this feature implemented in the last version of apectj.
Thanks.
Stéphane Chomat.

This sample code :

public class Link<T> extends SoftReference {

@SuppressWarnings("unchecked") Link(List<T> endPoints) {
       super(endPoints);
   }
@SuppressWarnings("unchecked")
   public List<T> getEndPoints() {
       return (List<T>)get();
   }
}

interface AssociationSource<T> {
public Link<T> getTarget(); public void setTarget(Link<T> _target);

}

aspect ExtendProduct {
       Link<T> AssociationSource._target = null;
public Link<T> AssociationSource.getTarget() {
           return _target;
       }
public void AssociationSource.setTarget(Link<T> _target) {
           this._target = _target;
       }
declare parents : ProductType implements AssociationSource<Product>;
       declare parents : Product     implements AssociationSource<Branch>;
declare parents : Branch implements AssociationSource<Revision>;
}




Back to the top