declare warning : execution(* *(!(Object+), ..)) : "mOne: value parameter";
// Wrong (matches f1 and f2, should match only f1): a Not type pattern containing @A and negatedPattern Object+ is built
-//broke declare warning : execution(* *(@A (!(Object+)), ..)) : "mTwo: @A annotated value parameter";
+ declare warning : execution(* *(@A (!(Object+)), ..)) : "mTwo: @A annotated value parameter";
// OK (matches f1):
declare warning : execution(* *(@A (*), ..)) && execution(* *(!(Object+), ..)): "mThree: @A annotated value parameter.";
declare warning : execution(* *(@A (*), ..)) && execution(* *(Object+, ..)): "mSix: @A annotated reference parameter.";
// Wrong (matches f1 and f2, should match only f2):
-//broke declare warning : execution(* *(!@A (!(Object+)), ..)) : "mSeven: Non-@A annotated value parameter!";
+ declare warning : execution(* *(!@A (!(Object+)), ..)) : "mSeven: Non-@A annotated value parameter!";
// Wrong (matches f1 and f2, should match only f2):
declare warning : execution(* *(!@A (*), ..)) && execution(* *(!(Object+), ..)): "mEight: Non-@A annotated value parameter.";
--- /dev/null
+ import java.lang.annotation.*;
+ import java.lang.annotation.Target;
+
+ public aspect Test2 {
+
+ declare warning : execution(* *(@A (!(Object+)), ..)) : "mOne"; // f1
+ declare warning : execution(* *(@A !String, ..)) : "mTwo"; // f3/f4
+
+ void f1(@A int i) {} // 9
+
+ void f2(int i) {} // 11
+
+ void f3(@A P i) {}
+
+ void f4(P i) {}
+
+ void f5(Integer i) {}
+
+ void f6(@A Integer i) {}
+
+ @Retention(RetentionPolicy.RUNTIME)
+ private static @interface A { }
+
+ @A static class P {}
+ }
\ No newline at end of file
public class ParameterAnnotationMatchingTests extends XMLBasedAjcTestCase {
public void testDeow() { runTest("deow"); }
+ public void testDeow2() { runTest("deow2"); }
public void testNoWarningForWrongType() { runTest("no xlint for wrong target");}
public void testVariousCombinations() { runTest("various combinations"); }
public void testVariousCombinationsCtors() { runTest("various combinations - ctors"); }
<!-- AspectJ v1.6.0 Parameter Annotation Matching Tests -->
<suite>
+ <ajc-test dir="features160/parameterAnnotationMatching" title="deow2">
+ <compile options="-1.5" files="Test2.java">
+ <message kind="warning" line="9" text="mOne"/>
+ <message kind="warning" line="13" text="mTwo"/>
+ <message kind="warning" line="15" text="mTwo"/>
+ </compile>
+ </ajc-test>
<ajc-test dir="features160/parameterAnnotationMatching" title="deow">
<compile options="-1.5" files="Test.java">
<message kind="warning" line="43" text="mOne"/>
<message kind="warning" line="45" text="mOne"/>
+ <message kind="warning" line="43" text="mTwo"/>
<message kind="warning" line="43" text="mThree"/>
<message kind="warning" line="47" text="mFour"/>
<message kind="warning" line="49" text="mFour"/>
<message kind="warning" line="47" text="mFive"/>
<message kind="warning" line="47" text="mSix"/>
+ <message kind="warning" line="45" text="mSeven"/>
+ <message kind="warning" line="45" text="mEight"/>
<message kind="warning" line="45" text="mNine"/>
+ <message kind="warning" line="49" text="mTen"/>
<message kind="warning" line="49" text="mEleven"/>
<message kind="warning" line="49" text="mTwelve"/>
- <message kind="warning" line="49" text="mTen"/>
- <message kind="warning" line="45" text="mEight"/>
- <!--
- <message kind="warning" line="43" text="mTwo"/>
- <message kind="warning" line="45" text="mSeven"/>
- -->
</compile>
</ajc-test>