You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README-1.9.3.adoc 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. = AspectJ 1.9.3
  2. _© Copyright 2018 Contributors. All rights reserved._
  3. The full list of resolved issues in 1.9.3 is available
  4. https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&f0=OP&f1=OP&f3=CP&f4=CP&j1=OR&list_id=16866879&product=AspectJ&query_format=advanced&target_milestone=1.9.3[here]
  5. _Release info: 1.9.3 available 4-Apr-2019_
  6. AspectJ 1.9.3 supports Java12. Java12 introduces the new switch
  7. expression syntax, but you must activate support for that via an
  8. `--enable-preview` flag when using the compiler and attempting to run the
  9. resultant classes: Here is `Switch3.java`:
  10. [source, java]
  11. ....
  12. public class Switch3 {
  13. public static void main(String[] argv) {
  14. System.out.println(one(Color.R));
  15. System.out.println(one(Color.G));
  16. System.out.println(one(Color.B));
  17. System.out.println(one(Color.Y));
  18. }
  19. public static int one(Color color) {
  20. int result = switch(color) {
  21. case R -> foo(0);
  22. case G -> foo(1);
  23. case B -> foo(2);
  24. default -> foo(3);
  25. };
  26. return result;
  27. }
  28. public static final int foo(int i) {
  29. return i+1;
  30. }
  31. }
  32. enum Color {
  33. R, G, B, Y;
  34. }
  35. aspect X {
  36. int around(): call(* foo(..)) {
  37. return proceed()*3;
  38. }
  39. }
  40. ....
  41. Compile it with:
  42. [source, text]
  43. ....
  44. $ ajc --enable-preview -showWeaveInfo -12 Switch3.java
  45. Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:12) advised by around advice from 'X' (Switch3.java:30)
  46. Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:13) advised by around advice from 'X' (Switch3.java:30)
  47. Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:14) advised by around advice from 'X' (Switch3.java:30)
  48. Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:15) advised by around advice from 'X' (Switch3.java:30)
  49. ....
  50. Now run it:
  51. [source, text]
  52. ....
  53. $ java --enable-preview Switch3
  54. 3
  55. 6
  56. 9
  57. 12
  58. ....