]> source.dussan.org Git - aspectj.git/commitdiff
227993: annotation value matching support for field annotations. plus hashcode/equals...
authoraclement <aclement>
Sat, 10 May 2008 00:33:22 +0000 (00:33 +0000)
committeraclement <aclement>
Sat, 10 May 2008 00:33:22 +0000 (00:33 +0000)
tests/bugs161/pr227993/FieldJP.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java
tests/src/org/aspectj/systemtest/ajc161/ajc161.xml

diff --git a/tests/bugs161/pr227993/FieldJP.java b/tests/bugs161/pr227993/FieldJP.java
new file mode 100644 (file)
index 0000000..e36de35
--- /dev/null
@@ -0,0 +1,41 @@
+
+import java.lang.annotation.*;
+
+enum Store {YES,NO;}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface SearchableProperty { Store store(); }
+
+public class FieldJP {
+    @SearchableProperty(store=Store.YES)
+    public static int fieldOne;
+    
+    @SearchableProperty(store=Store.NO)
+    public static int fieldTwo;
+    
+    public static int fieldThree;
+    
+    public static void main(String[] args) {
+        System.err.println("fone="+fieldOne);
+        System.err.println("ftwo="+fieldTwo);
+        System.err.println("fthr="+fieldThree);
+        fieldOne = 5;
+        fieldTwo = 6;
+        fieldThree = 7;
+    }
+}
+
+aspect X {
+    before(): get(@SearchableProperty(store=Store.YES) * *) {
+        System.err.println("get of YES field");
+    }
+    before(): get(@SearchableProperty(store=Store.NO) * *) {
+        System.err.println("get of NO field");
+    }
+    before(): set(@SearchableProperty(store=Store.YES) * *) {
+        System.err.println("set of YES field");
+    }
+    before(): set(@SearchableProperty(store=Store.NO) * *) {
+        System.err.println("set of NO field");
+    }
+}
\ No newline at end of file
index f9346d8b334e7ef31b9dcedb724c0fe8c6661418..def12d951118051aec2f68fb055ffc55d51d9be5 100644 (file)
@@ -19,6 +19,7 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
 public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        
        // AspectJ1.6.1
+    public void testFieldJoinpointsAndAnnotationValues_pr227993() { runTest("field jp anno value"); }
     public void testGenericsBoundsDecp_pr231187() { runTest("generics bounds decp"); }
     public void testGenericsBoundsDecp_pr231187_2() { runTest("generics bounds decp - 2"); }
        public void testLtwInheritedCflow_pr230134() { runTest("ltw inherited cflow"); }
index 9b631266b689b21c7a2a20a9c3b782eefde54fbd..4e9932df4711eb5a234b967675fcf76dbaf26473 100644 (file)
@@ -3,6 +3,22 @@
 <!-- AspectJ v1.6.1 Tests -->
 <suite>
 
+
+    <ajc-test dir="bugs161/pr227993" title="field jp anno value">
+        <compile files="FieldJP.java" options="-1.5"/>
+        <run class="FieldJP">
+          <stderr>
+            <line text="get of YES field"/>
+            <line text="fone=0"/>
+            <line text="get of NO field"/>
+            <line text="ftwo=0"/>
+            <line text="fthr=0"/>
+            <line text="set of YES field"/>
+            <line text="set of NO field"/>
+          </stderr>
+        </run>
+    </ajc-test> 
+
     <ajc-test dir="bugs161/pr231187x" title="generics bounds decp">
         <compile files="Cement.java ConcreteClass.java SuperClass.java SuperClassAspect.aj WetCement.java Main.java" options="-1.5"/>
         <run class="concrete.Main">