diff options
author | aclement <aclement> | 2005-01-25 20:18:42 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-01-25 20:18:42 +0000 |
commit | 1b01255892ef222c14fea25b5db77208f1f6bb13 (patch) | |
tree | 6a18243250b6ff16573a1e8c7b46221de825a975 /tests | |
parent | 159d6bd9422fc8ab300cfb88280d7ef3bf910a95 (diff) | |
download | aspectj-1b01255892ef222c14fea25b5db77208f1f6bb13.tar.gz aspectj-1b01255892ef222c14fea25b5db77208f1f6bb13.zip |
Fix for Bug 83563: pertypewithin() handling of inner classes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bugs150/PR83563_1.java | 23 | ||||
-rw-r--r-- | tests/bugs150/PR83563_2.java | 25 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/Ajc150TestsNoHarness.java | 12 |
3 files changed, 60 insertions, 0 deletions
diff --git a/tests/bugs150/PR83563_1.java b/tests/bugs150/PR83563_1.java new file mode 100644 index 000000000..834e450fe --- /dev/null +++ b/tests/bugs150/PR83563_1.java @@ -0,0 +1,23 @@ +public class PR83563_1 { + public static void main(String[] args) { + new NestedTest().run(); + int c = PertypewithinTest.aspectOf(PR83563_1.class).cnt; + if (c!=2) + throw new RuntimeException("Expected 2 advice executions: "+c); + } + + static class NestedTest implements Runnable { + public void run() { + System.out.println("Running..."); + } + } +} + +aspect PertypewithinTest pertypewithin(PR83563_1) { + public static int cnt = 0; + + before() : execution(* *.*(..)) { + cnt++; + System.out.println(thisJoinPointStaticPart); + } +} diff --git a/tests/bugs150/PR83563_2.java b/tests/bugs150/PR83563_2.java new file mode 100644 index 000000000..718f1f4d6 --- /dev/null +++ b/tests/bugs150/PR83563_2.java @@ -0,0 +1,25 @@ +public class PR83563_2 { + public void bar() { + new Runnable() { + public void run() { + System.out.println("Running..."); + } + }.run(); + } + + public static void main(String[] args) { + new PR83563_2().bar(); + int c = PertypewithinTest.aspectOf(PR83563_2.class).cnt; + if (c!=3) + throw new RuntimeException("Expected 3 advice executions but got:"+c); + } +} + +aspect PertypewithinTest pertypewithin(PR83563_2) { + public static int cnt = 0; + + before() : execution(* *.*(..)) { + cnt++; + System.out.println(thisJoinPoint); + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150TestsNoHarness.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150TestsNoHarness.java index 6ecac5189..3a446127b 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150TestsNoHarness.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150TestsNoHarness.java @@ -75,4 +75,16 @@ public class Ajc150TestsNoHarness extends TestUtils { CompilationResult cR = ajc(baseDir,new String[]{"PR83303.java"}); assertTrue("Should be no errors:"+cR,!cR.hasErrorMessages()); } + + public void testPerTypeWithinMissesNamedInnerTypes() { + CompilationResult cR = ajc(baseDir,new String[]{"PR83563_1.java"}); + assertTrue("Should be no errors:"+cR,!cR.hasErrorMessages()); + RunResult rR = run("PR83563_1"); + } + + public void testPerTypeWithinMissesAnonymousInnerTypes() { + CompilationResult cR = ajc(baseDir,new String[]{"PR83563_2.java"}); + assertTrue("Should be no errors:"+cR,!cR.hasErrorMessages()); + RunResult rR = run("PR83563_2"); + } }
\ No newline at end of file |