#2:
Here I have made a test which shows me that its possible to parameterize a HashSet with generic type /FROM/. This HashSet is a member of the aspect and is not introduced as a member of FROM.
Why is it ok to parameterize in this situation?
----------------------------- ----------------------------- ----------------------------- ----------------------------- -----------------------------
import java.util.*;
public abstract aspect SimpleStaticRel <FROM,TO>{
public static interface Fwd {}
//public static interface Bwd {}
declare parents : FROM implements Fwd;
// #1
final private HashSet<TO> Fwd.fwd = new HashSet<TO>();
//final private HashSet Fwd.fwd = new HashSet();
// #2
private HashSet<TO> myHash = new HashSet<TO>();
public boolean add(FROM _f, TO _t) {
myHash.add(_t);
return true;
}
public boolean andreasAdd(FROM _f, TO _t) {
Fwd forward = (Fwd) _f;
forward.fwd.add(_t);
return true;
}
}