import java.util.*; public aspect GenericParameterMatching { pointcut takesAMap() : execution(* *(Map)); // matches takesAMap, staticTakesAMap pointcut takesAnyMapType() : execution(* *(Map+)); // matches collectionOfAnything pointcut collectionOfAnyNumber() : execution(* *(Collection)); // matches collectionOfAnythingTakingADouble pointcut anyCollection() : execution(* *(Collection<*>)); // matches all 3 collection methods pointcut anyObjectOrSubtypeCollection() : execution(* *(Collection)); // matches collection of any number pointcut superTypePattern(): execution(* *(Collection)); // matches collection of anything taking a double // RTT matching... pointcut mapargs() : args(Map); // matches takesAMap, staticTakesAMap, takesAHashmap pointcut hashmapargs() : args(HashMap); // matches takesAHashmap, RT test for takesAMap, staticTakesAmap pointcut nomapargs(): args(Map); // no matches pointcut wildargs() : args(Map); // matches takesAMap, staticTakesAMap, takesAHashmap pointcut nowildargs() : args(Map); // no matches pointcut wildsuperargs() : args(Map); // matches takesAmap, staticTakesAmap, takesAHashmap // RTT matching with signature wildcards pointcut collAnythingArgs() : args(Collection); // matches all collection methods pointcut collNumberArgs() : args(Collection); // does NOT match collectionOfAnyNumber (can't insert safely) // does NOT match collectionOfAnythingTakingADouble (can't remove safely) pointcut collNumberArgsWild() : args(Collection); // matches collection of any number pointcut superDoubleArgs(): args(Collection); // matches coll taking a double // add max and copy tests here... }