Hi, seems like a generics aspects bug, although maybe a limitation. That is a pretty sophisticated aspect and I'd need to spend some time with pen and paper working out if what you are trying to do is (a) possible (b) supported. I would raise an AspectJ bug for clarification of this.
Andy 2009/8/9 Andreas Møller Holst <[email protected]> > Hi > > Im new to AOP and AspectJ. Currently Im studying an aspect oriented library > to support associations as cross cutting concerns. > > In this library I have an aspect /SimpleStaticRel/ that alters the type > hirarchy and introduce new members to the formal type parameters /FROM/ and > /TO/. > Below I present a snippet of the original implementation which is relevant > to my question. > > #1: > > If I declare /final private HashSet<TO> Fwd.fwd = new HashSet<TO>();/ I get > the follwoing compile error: The method add(TO) in the type HashSet<TO> is > not applicable for the arguments (TO) > forward.fwd.add(_t); > > #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; > } > > } > Thank you / dres > > > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > >
_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
