import java.util.*; /** * - returning(List) matches List but not List * - returning(List) matches List with unchecked warning * - returning(List) matches List with unchecked warning * - returning(List) matches List with unchecked warning * - returning(List) matches List (String is final) */ public aspect AfterReturningParameterized { public static void main(String[] args) { List ls = new ArrayList(); // ls.add("one"); // ls.add("two"); // ls.add("three"); Generic g = new Generic(); g.foo(ls); g.bar(ls); g.tada(ls); g.afar(new ArrayList()); g.something(ls); MustBeString mbs = new MustBeString(); mbs.listit(ls); } after() returning(List ls) : call(* *(..)) { System.out.println("returning(List matched at " + thisJoinPointStaticPart); ls.add("four"); String s = ls.get(0); } } class Generic { List foo(List lt) { return lt; } List bar(List ls) { return ls; } List tada(List l) { return l; } List afar(List ln) { return ln; } List something(List ls) { return ls; } } class MustBeString { List listit(List lt) { return lt; } }