]> source.dussan.org Git - aspectj.git/commitdiff
tests and fix for pr109124, not correctly recognizing synthetic fields under 1.5
authoracolyer <acolyer>
Fri, 9 Sep 2005 10:48:58 +0000 (10:48 +0000)
committeracolyer <acolyer>
Fri, 9 Sep 2005 10:48:58 +0000 (10:48 +0000)
tests/bugs150/VerifyErrorOnSet.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
weaver/src/org/aspectj/weaver/bcel/BcelField.java

diff --git a/tests/bugs150/VerifyErrorOnSet.aj b/tests/bugs150/VerifyErrorOnSet.aj
new file mode 100644 (file)
index 0000000..a37f027
--- /dev/null
@@ -0,0 +1,35 @@
+package test;
+public class VerifyErrorOnSet {
+
+       class Node {
+               int value;
+
+               Node(int v)
+               {
+                       value = v;
+               }
+       }
+
+
+       public VerifyErrorOnSet()
+       {
+               new Node(1);
+       }
+
+       public static void main(String[] args) {
+          VerifyErrorOnSet l = new VerifyErrorOnSet();
+       }
+}
+
+
+aspect ListAspect {
+
+       pointcut setField(Object t) : target(t) && set(* VerifyErrorOnSet.Node+.*);
+       
+       before(Object t) : setField(t) {
+               System.out.println("WRITE");
+               // Do something with t...
+       }
+       
+}
index f129c6f9f98a9391b755cc0b36eb573f209042cd..08dba80f33491a723cef1d7afbfece0417693e30 100644 (file)
@@ -409,6 +409,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testNoUnusedParameterWarningsForSyntheticAdviceArgs() {
          runTest("no unused parameter warnings for synthetic advice args");
   }
+  
+  public void testNoVerifyErrorWithSetOnInnerType() {
+         runTest("no verify error with set on inner type");
+  }
   // helper methods.....
   
   public SyntheticRepository createRepos(File cpentry) {
index c9e48d1b3262fdb8fc9d9c09722c56eccb025e2d..b8ba23212feb961ce5ac32813aa230b9fe81838c 100644 (file)
         <compile files="pr109042.aj" options="-warn:+unusedArgument -warn:+unusedPrivate -warn:+unusedImport -1.5">
         </compile>
     </ajc-test>  
+    
+    <ajc-test dir="bugs150" pr="109124" title="no verify error with set on inner type">
+        <compile files="VerifyErrorOnSet.aj" options="-1.5" >
+        </compile>
+        <run class="test.VerifyErrorOnSet"/>
+    </ajc-test>  
+        
+    
     <!-- ============================================================================ -->
     <!-- ============================================================================ -->
     
index ad8edab0db6f7538ab896e17211987746ffa1c06..0e6f0f16211aa898d988d6d682b5b1525ceba369 100644 (file)
@@ -34,6 +34,8 @@ import org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.GenericSigna
 
 final class BcelField extends ResolvedMemberImpl {
 
+       private static int AccSynthetic = 0x1000;
+       
        private Field field;
        private boolean isAjSynthetic;
        private boolean isSynthetic = false;
@@ -78,6 +80,12 @@ final class BcelField extends ResolvedMemberImpl {
                for (int i = attrs.length - 1; i >= 0; i--) {
                        if (attrs[i] instanceof Synthetic) isSynthetic = true;
                }
+               
+               // in 1.5, synthetic is a modifier, not an attribute
+               if ((field.getModifiers() & AccSynthetic) != 0) {
+                       isSynthetic = true;
+               }
+               
        }