diff options
author | wisberg <wisberg> | 2003-12-23 01:28:08 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-12-23 01:28:08 +0000 |
commit | 6cded1d30cf1e59ee133ac08f44dabb7859b4fed (patch) | |
tree | 530fde3c045fd2b0aa8bc2ec5f08a9c975d009ac /tests | |
parent | 700a1a3b0cbe02993fedf1bc9598dd96fc5aab85 (diff) | |
download | aspectj-6cded1d30cf1e59ee133ac08f44dabb7859b4fed.tar.gz aspectj-6cded1d30cf1e59ee133ac08f44dabb7859b4fed.zip |
@testcase PR#49295 extra warning (join point?) for interface-typepattern execution
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ajcTestsFailing.xml | 10 | ||||
-rw-r--r-- | tests/bugs/SubtypeConstructorCW.java | 67 |
2 files changed, 77 insertions, 0 deletions
diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index fe3fdc664..db19ce857 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -141,5 +141,15 @@ <run class="AfterReturningParamMatching"/> </ajc-test> + <ajc-test dir="bugs" + pr="49295" + title="declare warning on subtype constructor"> + <compile files="SubtypeConstructorCW.java" > + <message kind="warning" line="5" text="String as first"/> + <message kind="warning" line="10" text="String as first"/> + </compile> + <run class="SubtypeConstructorCW"/> + </ajc-test> + </suite> diff --git a/tests/bugs/SubtypeConstructorCW.java b/tests/bugs/SubtypeConstructorCW.java new file mode 100644 index 000000000..d3b6a8765 --- /dev/null +++ b/tests/bugs/SubtypeConstructorCW.java @@ -0,0 +1,67 @@ + +import org.aspectj.testing.Tester; + + +class C implements Runnable { // CW 5 + public void run() { + } +} +class F implements Runnable { + F(int i) {// CW 10 + } + public void run() { + } +} + +/** @testcase PR#49295 extra warning (join point?) for typepattern-type execution */ +public class SubtypeConstructorCW { + public static void main(String[] args) { + new C().run(); + new D("").run(); + new E("", 0).run(); + new F(0).run(); + } +} + +class D implements Runnable { + D(String s) { + } + public void run() { + } +} + +class E implements Runnable { + E(String s, int i) { + } + public void run() { + } +} + +// XXX warning: harness might ignore duplicates, so this can give false positives +aspect A { + static { + Tester.expectEvents( + new String[] { + "before execution(C())", + "before execution(F(int))", + }); + } + static void event(String s) { + System.out.println(" \"" + s + "\","); + } + // getting two warning rather than one, and on wrong places + declare warning : execution((Runnable +).new (..)) + && !execution(new (String, + . + .)) : "Runnable constructors should take String as first parameter"; + + // this works as expected + // declare warning: execution((!Runnable && Runnable+).new(..)) + // && !execution(new(String, ..)) + // : "Runnable constructors should take String as first parm"; + + before() : execution((Runnable +).new (..)) + && !execution(new (String,..)) { + event("before " + thisJoinPointStaticPart); + } +} |