import java.util.*; public aspect GenericMethods { declare warning : execution(Object whoAmI(Object)) : "static generic method match"; declare warning : withincode(Number myFavourite(List)) : "instance generic method match"; // should we have an XLint to explain why the pointcut below does not match? declare warning : execution(* myFavourite(List)) : "no match because erasure is List"; } class PlainClassWithGenericMethods { public static T whoAmI(T t) { return t; } public S myFavourite(List ls) { return ls.get(0); } } class GenericClassWithGenericMethods { N n; public static T whoAmI(T t) { return t; } public S myFavourite(List ls) { return ls.get(0); } }