Bug 153966 - Unoptimized matching/weaving for value-binding pointcuts
Summary: Unoptimized matching/weaving for value-binding pointcuts
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-15 14:51 EDT by Eric Bodden CLA
Modified: 2007-10-24 12:03 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Bodden CLA 2006-08-15 14:51:42 EDT
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.
Comment 1 Ron Bodkin CLA 2006-08-15 16:45:54 EDT
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.