diff options
Diffstat (limited to 'tests/features1921/java21/UnderscoreInPointcutAspect.aj')
-rw-r--r-- | tests/features1921/java21/UnderscoreInPointcutAspect.aj | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/features1921/java21/UnderscoreInPointcutAspect.aj b/tests/features1921/java21/UnderscoreInPointcutAspect.aj new file mode 100644 index 000000000..41ed65d15 --- /dev/null +++ b/tests/features1921/java21/UnderscoreInPointcutAspect.aj @@ -0,0 +1,53 @@ +public aspect UnderscoreInPointcutAspect { + public static void main(String[] args) { + UnderTest u = new UnderTest(); + System.out.println(u._add(12, 4)); + System.out.println(u._subtract(12, 4)); + System.out.println(u.multiply_(12, 4)); + System.out.println(u.divide_(12, 4)); + System.out.println(u.power_of(3, 3)); + System.out.println(u.squareRoot(49)); + } + + before(int a, int b) : execution(* _*(..)) && args(a, b) { + System.out.println("[starts with underscore] " + thisJoinPoint + " -> " + a + ", " + b); + } + + before(int a, int b) : execution(* *_(..)) && args(a, b) { + System.out.println("[ends with underscore] " + thisJoinPoint + " -> " + a + ", " + b); + } + + before(int a, int b) : execution(* *_*(..)) && args(a, b) { + System.out.println("[contains underscore] " + thisJoinPoint + " -> " + a + ", " + b); + } + + before(int a) : execution(* *(..)) && !execution(* *_*(..)) && args(a) { + System.out.println("[no underscore] " + thisJoinPoint + " -> " + a); + } +} + +class UnderTest { + int _add(int a, int b) { + return a + b; + } + + int _subtract(int a, int b) { + return a - b; + } + + int multiply_(int a, int b) { + return a * b; + } + + int divide_(int a, int b) { + return a / b; + } + + int power_of(int base, int exponent) { + return (int) Math.pow(base, exponent); + } + + int squareRoot(int a) { + return (int) Math.sqrt(a); + } +} |