Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Capturing data at a pointcut

Hi,

A little confused about what you mean by #1.  What is the fully
qualified name of a local variable?  Or are you only looking to do
this for fields?  If so, how are you planning on distinguishing them?

It is not hard to get the type of the field/variable:
thisJoinPointStaticPart.getSignature().getDeclaringType()

But getting its name and the class that declares it is harder.  This
is just not information that AspectJ stores.  One of the reasons that
this is not stored is because aliasing can make this information
meaningless.  For example:

class C1 {
   Set s = new HashSet();

   private void doNothing() {
      Set t = s;
      t.add(null);
      s.add(null);
   }
}

Here objects t and s are the same, but have different names.  What
would you want to do here?  Do you really want to know where the
variable was declared or do you want to know what the variable points
to?

On Wed, Apr 22, 2009 at 12:31 AM, 100ji <itz100ji@xxxxxxxxx> wrote:
> Hi all,
>
> I am implementing some dynamic programming analysis using AspectJ. For
> example, consider the program:
>
> Set<Object> s = new HashSet<Object>();
> s.add(o1);
> s.remove(o1);
>
> In this program at each add and remove method call, I need the
> following information:
>
> 1) a string showing the type of s and a fully qualified name of the
> field with the name of the field. "java.util.Set com.x.y.z.a.b.c.s".
> 2) a reference to object o1.
> 3) a reference to set s.
> 4) The lineno and the file name at which the call is taking place.
>
> I can get (2), (3) and (4) using the argument, target and
> thisJoinPoint.getStaticpart.getLineNo() respectively. How can I get
> (1) the name of the field s and it's type from a point cut?
>
> Thanks,
> -S-
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top