Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] a java method containing labels

KPatrick@xxxxxxxxxx wrote:



I need to instrument methods that contain a lot of in-line code that
contain loops and very few method calls. I was hoping to have the ability
to add a label and define an aspect based on the label.



kevin


It's not elegant but you could just use methods instead of labels...

public class KPatrick {
  public static void main(String[] args) {
    label1();
    for (int i = 0; i < 100; i++) boo();
    label2();
    for (int i = 0; i < 100; i++) mumble();
    label3();
    for (int i = 0; i < 100; i++) hiss();
  }

  static void boo() {}
  static void mumble() {}
  static void hiss() {}

  static void label1() {}
  static void label2() {}
  static void label3() {}

  static aspect A {
    before():
      execution(* *.label1()) {System.out.println("before label1");}
  }
}

Jeff


"Wes Isberg" <wes@california.c om> To Sent by: aspectj-dev@xxxxxxxxxxx aspectj-dev-admin cc @eclipse.org Subject Re: [aspectj-dev] a java method 08/25/2004 01:35 containing labels PM Please respond to aspectj-dev@eclip se.org



AspectJ can work with any Java code, but there's no AspectJ
language support for picking out labels in particular.
What are you trying to do?

Wes


------------Original Message------------
From: KPatrick@xxxxxxxxxx
To: aspectj-dev@xxxxxxxxxxx
Date: Wed, Aug-25-2004 12:14 PM
Subject: [aspectj-dev] a java method containing labels





Trying to figure out if aspectJ can operate on code that follows a
label or
possibly operate on a block of code between two labels. Any
information,
references or examples would be greatly appreciated.

Kevin




_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev




_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev


_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev




--
Jeffrey Palm --> http://www.ccs.neu.edu/home/jpalm


Back to the top