]> source.dussan.org Git - aspectj.git/commitdiff
Fix for Bugzilla Bug 46280
authorjhugunin <jhugunin>
Wed, 14 Jan 2004 11:28:13 +0000 (11:28 +0000)
committerjhugunin <jhugunin>
Wed, 14 Jan 2004 11:28:13 +0000 (11:28 +0000)
   compiler issues error on inner aspects when privilieged

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/parser/AjParser.java
tests/ajcTests.xml
tests/bugs/PrivilegedParsing.java [new file with mode: 0644]

index 1b1512d28c182a745ce6520fa8231765561422f3..be36f8dca67688498b756637402fced1bc0cc655 100644 (file)
@@ -230,6 +230,10 @@ public class AjParser extends Parser {
                }
                aspectDecl.modifiersSourceStart = intStack[intPtr--];
                aspectDecl.modifiers = intStack[intPtr--];
+               if (isPrivileged) {
+                       aspectDecl.modifiersSourceStart = intStack[intPtr--];
+                       aspectDecl.modifiers |= intStack[intPtr--];
+               }
                if (aspectDecl.modifiersSourceStart >= 0) {
                        aspectDecl.declarationSourceStart = aspectDecl.modifiersSourceStart;
                }
index 8b48f4cda25f90fd8afd5755e3fe9322b343b812..6a68bc4a66241e613db57b09c57df955a6c5cf39 100644 (file)
                  <message kind="error" line="8"/>
         </compile>
     </ajc-test>     
+    
+    <ajc-test dir="bugs" 
+               pr="46280"
+               title="compiler issues error on inner aspects when privilieged">
+        <compile files="PrivilegedParsing.java"/>
+        <run class="PrivilegedParsing"/>
+    </ajc-test>
 
     <ajc-test dir="bugs" pr="44586"
       title="After throwing advice on ctors doesn't execute for inter-type decl field inits">
diff --git a/tests/bugs/PrivilegedParsing.java b/tests/bugs/PrivilegedParsing.java
new file mode 100644 (file)
index 0000000..4fd0e66
--- /dev/null
@@ -0,0 +1,41 @@
+public class PrivilegedParsing {
+   private int hidden;
+   public int visible;
+   public PrivilegedParsing(int priv, int pub) {
+      hidden = priv;
+      visible = pub;
+   }
+   public void doSomething() {
+      System.out.println("" + hidden + ", " + visible + "");
+   }
+   public static void main(String[] args) {
+      PrivilegedParsing capsule = new PrivilegedParsing(1, 1);
+      capsule.doSomething();
+   }
+}
+
+aspect Outer {
+   static privileged //<== JUST TRY TO UNCOMMENT THIS!
+   aspect Inner {
+      pointcut call2doSomething(PrivilegedParsing capsule):
+         call(void PrivilegedParsing.doSomething())
+         && target(capsule);
+      before(PrivilegedParsing capsule): call2doSomething(capsule) {
+         capsule.visible++;
+         capsule.hidden++;
+      }
+   }
+}
+
+interface Marker {
+   static privileged //<== JUST TRY TO UNCOMMENT THIS!
+   aspect Inner {
+      pointcut call2doSomething(PrivilegedParsing capsule):
+         call(void PrivilegedParsing.doSomething())
+         && target(capsule);
+      before(PrivilegedParsing capsule): call2doSomething(capsule) {
+         capsule.visible++;
+         capsule.hidden++;
+      }
+   }
+}
\ No newline at end of file