--- /dev/null
+package de.scrum_master.app;
+
+public class Apple {
+ private String type;
+ private boolean sweet;
+
+ public Apple(String type, boolean sweet) {
+ this.type = type;
+ this.sweet = sweet;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public boolean isSweet() {
+ return sweet;
+ }
+}
+
--- /dev/null
+package de.scrum_master.app;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class AppleController {
+ private static final List<Apple> APPLES =
+ Arrays.asList(new Apple("Granny Smith", false), new Apple("Golden Delicious", true));
+
+ public static void main(String[] args) {
+ AppleController appleController = new AppleController();
+ System.out.println("Named: " + appleController.namedApples(APPLES, "Smith"));
+ System.out.println("Sweet: " + appleController.sweetApples(APPLES));
+ System.out.println("Sour: " + appleController.sourApples(APPLES));
+ }
+}
--- /dev/null
+package de.scrum_master.aspect;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import java.util.function.Predicate;
+import de.scrum_master.app.Apple;
+import de.scrum_master.app.AppleController;
+
+public privileged aspect AppleControllerITDAspect {
+ public List<Apple> AppleController.namedApples(List<Apple> apples, String subString) {
+ // Anonymous subclass works
+ return apples.stream().filter(new Predicate<Apple>() {
+ @Override
+ public boolean test(Apple a) {
+ return a.getType().contains(subString);
+ }
+ }).collect(Collectors.toList());
+ }
+
+ public List<Apple> AppleController.sweetApples(List<Apple> apples) {
+ // Method reference works
+ return apples.stream().filter(Apple::isSweet).collect(Collectors.toList());
+ }
+
+ public List<Apple> AppleController.sourApples(List<Apple> apples) {
+ // Lambda causes IllegalAccessError
+ return apples.stream().filter(a -> !a.isSweet()).collect(Collectors.toList());
+ }
+}
<compile files="module-info.java aaa/bbb/A.java" options="-1.9" outjar="my.module.jar"/>
<file deletefile="module-info.java"/>
<file deletefile="aaa"/>
- <compile files="Azpect.java" outjar="azpects.jar"/>
+ <compile files="Azpect.java" outjar="azpects.jar" options="-1.4"/>
<compile options="-showWeaveInfo" inpath="my.module.jar" aspectpath="azpects.jar" outjar="my.module.woven.jar">
<message kind="weave" text="Join point 'method-execution(void aaa.bbb.A.main(java.lang.String[]))' in Type 'aaa.bbb.A' (A.java:4) advised by before advice from 'aspects.Azpect' (azpects.jar!Azpect.class:4(from Azpect.java))"/>
</compile>
*/
public class Ajc192Tests extends XMLBasedAjcTestCase {
+ public void testITDLambdas() throws Exception {
+ runTest("itd lambdas");
+ }
+
public void test11Flags() throws Exception {
runTest("11flags");
}
<suite>
+ <ajc-test dir="bugs192/513528" title="itd lambdas">
+ <compile files="Apple.java AppleController.java AppleControllerITDAspect.java" options="-11">
+ </compile>
+ <run class="de.scrum_master.app.AppleController">
+ </run>
+ </ajc-test>
+
<ajc-test dir="bugs192/11flags" title="11flags">
<compile files="A.java" options="-11 -showWeaveInfo">
<message kind="weave" text="Join point 'method-execution(void A.foo())' in Type 'A' (A.java:8) advised by before advice from 'X' (A.java:12)"/>