-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for underscores in pointcuts on Java 21+
See also: eclipse-aspectj/eclipse.jdt.core@5d2f2aecd2 Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
- Loading branch information
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters