Community
Participate
Working Groups
Hi. Please have a look at the following code snippet: before(soot.PointsToSet pts): call(* java.util.Map+.put(..)) && args(pts,..) || call(* java.util.Collection+.add(..)) && args(pts){ ByteArrayOutputStream bos = new ByteArrayOutputStream(); new Exception().printStackTrace(new PrintStream(bos)); String s = bos.toString(); s = pts.getClass() + "\n" + s; if(strings.add(s)) { System.err.println(s); } } By the declared type "PointsToSet" of "pts", it should be clear that this advice can only apply when an object is put into a map or collection which can possibly be a subtype of PointsToSet. However, ajdt shows me that in the line ... if(strings.add(s)) { ... there is a match with dynamic residue. This seems wrong. AspectJ should be easily capable of detecting statically that this shadow can never match.
I googled and soot.PointsToSet is an interface. Normally you do need runtime tests whenever there's a test for a class being an instance of an interface. For final types you wouldn't ever need a runtime test... except that AspectJ supports declare parents. If you wove into rt.jar you could use: declare parents: String implements soot.PointsToSet; So should AspectJ be making special case assumptions that you aren't weaving into rt.jar? I would argue no, it should not.