From 0e2c95a36900fe913f5d768e7f4632034ddf005b Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Wed, 3 Apr 2019 10:23:44 -0700 Subject: Updated with Java12 support --- docs/dist/doc/README-193.html | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'docs/dist') diff --git a/docs/dist/doc/README-193.html b/docs/dist/doc/README-193.html index 6bcf89e75..f9cc4d0cf 100644 --- a/docs/dist/doc/README-193.html +++ b/docs/dist/doc/README-193.html @@ -20,6 +20,72 @@ All rights reserved.

The full list of resolved issues in 1.9.3 is available here.

+

AspectJ 1.9.3 supports Java12. Java12 introduces the new switch expression syntax, but you must activate support for that via +an --enable-preview flag when using the compiler and attempting to run the resultant classes: + +Here is Switch3.java: +


+=========8<=========
+public class Switch3 {
+	public static void main(String[] argv) {
+		System.out.println(one(Color.R));
+		System.out.println(one(Color.G));
+		System.out.println(one(Color.B));
+		System.out.println(one(Color.Y));
+	}
+
+	public static int one(Color color) {
+		int result = switch(color) {
+		 case R -> foo(0);
+		 case G -> foo(1);
+		 case B -> foo(2);
+		 default -> foo(3);
+		};
+		return result;
+	}
+	
+	public static final int foo(int i) {
+		return i+1;
+	}
+}
+
+enum Color {
+	R, G, B, Y;
+}
+
+aspect X {
+	int around(): call(* foo(..)) {
+		return proceed()*3;
+	}
+}
+=========8<=========
+
+ +Compile it with: +

+$ ajc --enable-preview -showWeaveInfo -12 Switch3.java
+
+Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:12) advised by around advice from 'X' (Switch3.java:30)
+
+Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:13) advised by around advice from 'X' (Switch3.java:30)
+
+Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:14) advised by around advice from 'X' (Switch3.java:30)
+
+Join point 'method-call(int Switch3.foo(int))' in Type 'Switch3' (Switch3.java:15) advised by around advice from 'X' (Switch3.java:30)
+
+
+ +Now run it: +

+$ java --enable-preview Switch3
+3
+6
+9
+12
+
+ + +

Available: 1.9.3.RC1 available 7-Mar-2019



-- cgit v1.2.3