diff options
author | Andy Clement <aclement@pivotal.io> | 2018-10-01 16:10:02 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2018-10-01 16:10:02 -0700 |
commit | 749b9cb3ca8e4680fca4252b0d782b7154eccb75 (patch) | |
tree | c2abf1231aac79a08469c92b319b4882991bf3b7 /tests | |
parent | f6d9aaaf05eca3aaf06d3a769a83f302b0501dca (diff) | |
download | aspectj-749b9cb3ca8e4680fca4252b0d782b7154eccb75.tar.gz aspectj-749b9cb3ca8e4680fca4252b0d782b7154eccb75.zip |
More fixes for 1.9.2V1_9_2_RC2
- update to more recent JDT to pickup Nestmates fix
- bcel updated for NestMembers/NestHost attributes
- testcases for nestmates
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bugs180/415957/MyAspect.aj | 2 | ||||
-rw-r--r-- | tests/bugs180/415957/MyClass.java | 2 | ||||
-rw-r--r-- | tests/bugs180/415957/Resource.java | 4 | ||||
-rw-r--r-- | tests/bugs192/535156/DemoApp.class | bin | 0 -> 2210 bytes | |||
-rw-r--r-- | tests/bugs192/535156/X.class | bin | 0 -> 1732 bytes | |||
-rw-r--r-- | tests/bugs192/nestmates/Outer.java | 9 | ||||
-rw-r--r-- | tests/bugs192/nestmates/Outer2$Inner2.class | bin | 0 -> 919 bytes | |||
-rw-r--r-- | tests/bugs192/nestmates/Outer2.class | bin | 0 -> 1381 bytes | |||
-rw-r--r-- | tests/bugs192/nestmates/Outer2.java | 21 | ||||
-rw-r--r-- | tests/bugs192/nestmates/X.class | bin | 0 -> 2894 bytes | |||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java | 26 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc192/ajc192.xml | 17 |
12 files changed, 79 insertions, 2 deletions
diff --git a/tests/bugs180/415957/MyAspect.aj b/tests/bugs180/415957/MyAspect.aj index 673463a55..9d900ff2c 100644 --- a/tests/bugs180/415957/MyAspect.aj +++ b/tests/bugs180/415957/MyAspect.aj @@ -1,5 +1,5 @@ public aspect MyAspect { - pointcut all(): execution(@javax.annotation.Resource * *(..)); + pointcut all(): execution(@Resource * *(..)); before(): all() { diff --git a/tests/bugs180/415957/MyClass.java b/tests/bugs180/415957/MyClass.java index 7b596ffd0..b6ea71267 100644 --- a/tests/bugs180/415957/MyClass.java +++ b/tests/bugs180/415957/MyClass.java @@ -1,5 +1,5 @@ public class MyClass { - @javax.annotation.Resource + @Resource public void method() { } } diff --git a/tests/bugs180/415957/Resource.java b/tests/bugs180/415957/Resource.java new file mode 100644 index 000000000..e9ae957ac --- /dev/null +++ b/tests/bugs180/415957/Resource.java @@ -0,0 +1,4 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface Resource {} diff --git a/tests/bugs192/535156/DemoApp.class b/tests/bugs192/535156/DemoApp.class Binary files differnew file mode 100644 index 000000000..0a2a5f3ae --- /dev/null +++ b/tests/bugs192/535156/DemoApp.class diff --git a/tests/bugs192/535156/X.class b/tests/bugs192/535156/X.class Binary files differnew file mode 100644 index 000000000..fce34aedc --- /dev/null +++ b/tests/bugs192/535156/X.class diff --git a/tests/bugs192/nestmates/Outer.java b/tests/bugs192/nestmates/Outer.java new file mode 100644 index 000000000..42a102c68 --- /dev/null +++ b/tests/bugs192/nestmates/Outer.java @@ -0,0 +1,9 @@ +public class Outer { + private int i = 0; + + public class Inner { + public int i() { + return i; + } + } +} diff --git a/tests/bugs192/nestmates/Outer2$Inner2.class b/tests/bugs192/nestmates/Outer2$Inner2.class Binary files differnew file mode 100644 index 000000000..cccfb99d3 --- /dev/null +++ b/tests/bugs192/nestmates/Outer2$Inner2.class diff --git a/tests/bugs192/nestmates/Outer2.class b/tests/bugs192/nestmates/Outer2.class Binary files differnew file mode 100644 index 000000000..15192992d --- /dev/null +++ b/tests/bugs192/nestmates/Outer2.class diff --git a/tests/bugs192/nestmates/Outer2.java b/tests/bugs192/nestmates/Outer2.java new file mode 100644 index 000000000..de5dc10f6 --- /dev/null +++ b/tests/bugs192/nestmates/Outer2.java @@ -0,0 +1,21 @@ +public class Outer2 { + private int i = 0; + + public static void main(String []argv) { + Outer2 o2 = new Outer2(); + Inner2 i2 = o2.new Inner2(); + System.out.println(i2.i()); + } + + public class Inner2 { + public int i() { + return i; + } + } + +} + +aspect X { +before(): execution(* Outer2.main(..)) { System.out.println("Before main()");} +before(): execution(* Outer2.Inner2.i(..)) { System.out.println("Before i()");} +} diff --git a/tests/bugs192/nestmates/X.class b/tests/bugs192/nestmates/X.class Binary files differnew file mode 100644 index 000000000..a8887a54c --- /dev/null +++ b/tests/bugs192/nestmates/X.class diff --git a/tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java b/tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java index 66bae0c9d..84e0f9d39 100644 --- a/tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc192/Ajc192Tests.java @@ -12,6 +12,9 @@ package org.aspectj.systemtest.ajc192; import java.io.File; +import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.NestHost; +import org.aspectj.apache.bcel.classfile.NestMembers; import org.aspectj.testing.XMLBasedAjcTestCase; import junit.framework.Test; @@ -21,6 +24,29 @@ import junit.framework.Test; */ public class Ajc192Tests extends XMLBasedAjcTestCase { + public void testNestmates() throws Exception { + runTest("nestmates"); + JavaClass outer = getClassFrom(ajc.getSandboxDirectory(), "Outer"); + JavaClass inner = getClassFrom(ajc.getSandboxDirectory(), "Outer$Inner"); + NestMembers nestMembers = (NestMembers) getAttributeStartsWith(outer.getAttributes(),"NestMembers"); + assertEquals(1,nestMembers.getClasses().length); + assertEquals("Outer$Inner",nestMembers.getClassesNames()[0]); + NestHost nestHost = (NestHost) getAttributeStartsWith(inner.getAttributes(),"NestHost"); + assertEquals("Outer",nestHost.getHostClassName()); + } + + // Verifying not destroyed on weaving + public void testNestmates2() throws Exception { + runTest("nestmates 2"); + JavaClass outer = getClassFrom(ajc.getSandboxDirectory(), "Outer2"); + JavaClass inner = getClassFrom(ajc.getSandboxDirectory(), "Outer2$Inner2"); + NestMembers nestMembers = (NestMembers) getAttributeStartsWith(outer.getAttributes(),"NestMembers"); + assertEquals(1,nestMembers.getClasses().length); + assertEquals("Outer2$Inner2",nestMembers.getClassesNames()[0]); + NestHost nestHost = (NestHost) getAttributeStartsWith(inner.getAttributes(),"NestHost"); + assertEquals("Outer2",nestHost.getHostClassName()); + } + public void testCflowFinal() { runTest("no final on cflow elements"); } diff --git a/tests/src/org/aspectj/systemtest/ajc192/ajc192.xml b/tests/src/org/aspectj/systemtest/ajc192/ajc192.xml index 5eb7fcbbb..eb846e7cf 100644 --- a/tests/src/org/aspectj/systemtest/ajc192/ajc192.xml +++ b/tests/src/org/aspectj/systemtest/ajc192/ajc192.xml @@ -2,6 +2,23 @@ <suite> + <ajc-test dir="bugs192/nestmates" title="nestmates"> + <compile files="Outer.java" options="-11"> + </compile> + </ajc-test> + + + <ajc-test dir="bugs192/nestmates" title="nestmates 2"> + <compile files="Outer2.java" options="-11"> + </compile> + <run class="Outer2"> + <stdout> + <line text="Before main()"/> + <line text="Before i"/> + <line text="0"/> + </stdout></run> + </ajc-test> + <ajc-test dir="bugs192/537825" title="no final on cflow elements"> <compile files="Code.java" options="-9"> </compile> |