]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for Bug 150671: declare error on set of volatile field does not work
authoraclement <aclement>
Tue, 25 Jul 2006 07:46:13 +0000 (07:46 +0000)
committeraclement <aclement>
Tue, 25 Jul 2006 07:46:13 +0000 (07:46 +0000)
tests/bugs153/pr150671.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml
weaver/src/org/aspectj/weaver/ResolvedMemberImpl.java

diff --git a/tests/bugs153/pr150671.aj b/tests/bugs153/pr150671.aj
new file mode 100644 (file)
index 0000000..86f495b
--- /dev/null
@@ -0,0 +1,16 @@
+class C {
+
+          private volatile int state;
+          private int test;
+          
+          public void foo() {
+             state = 0;
+             test = 0;
+          }
+       
+}
+
+aspect FSM {
+          declare error: set(* C.state): "Changing state";
+          declare error: set(* C.test): "test";
+}
index 4878bb045d9033b03cfdb15d7ba636334bbefe8a..111800bef9bd8838373bd506ba87808d83d1374b 100644 (file)
@@ -46,6 +46,8 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testCantFindType_pr149322_02() {runTest("can't find type on interface call 2");}
   public void testCantFindType_pr149322_03() {runTest("can't find type on interface call 3");}
 
+  public void testMatchVolatileField_pr150671() {runTest("match volatile field");};
+  
   /////////////////////////////////////////
   public static Test suite() {
     return XMLBasedAjcTestCase.loadSuite(Ajc153Tests.class);
index a8b4c6034da9da7c216f4b8724cf50db1a714396..94026f753eef10db7cad4617caa915f140fc8181 100644 (file)
                </stdout>
        </run>
     </ajc-test>    
+  
+    <ajc-test dir="bugs153" title="match volatile field">
+      <compile files="pr150671.aj" options="-Xset:activateLightweightDelegates=false">
+        <message kind="error" line="7" text="Changing state"/>
+        <message kind="error" line="8" text="test"/>
+      </compile>
+    </ajc-test>
     
 </suite>
\ No newline at end of file
index 71eb910cb7aa839e9d66f2d228b3cc6200373e99..f5bd991c7bdf0246e2c613ce17b99804cd5c891b 100644 (file)
@@ -321,7 +321,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno
        }
            
     public boolean isBridgeMethod() {
-       return (modifiers & Constants.ACC_BRIDGE)!=0;
+       return (modifiers & Constants.ACC_BRIDGE)!=0 && getKind().equals(METHOD);
     }
     
     public boolean isVarargsMethod() {