]> source.dussan.org Git - aspectj.git/commitdiff
@testcase PR#XXX omnibus privileged access from aspectj-users mail "Problem with...
authorwisberg <wisberg>
Sun, 7 Sep 2003 19:04:00 +0000 (19:04 +0000)
committerwisberg <wisberg>
Sun, 7 Sep 2003 19:04:00 +0000 (19:04 +0000)
tests/ajcTestsFailing.xml
tests/bugs/privilege/packageProtected/concern/BaseTarget.java [new file with mode: 0644]
tests/bugs/privilege/packageProtected/concern/ContextUser.java [new file with mode: 0644]
tests/bugs/privilege/packageProtected/core/Base.java [new file with mode: 0644]

index 485c4e1e651e11acffdffd548f92963994a36659..3a66c89e0b717709f99680404733500489852a10 100644 (file)
@@ -4,7 +4,18 @@
 <!-- contains valid tests that the compiler has never passed -->
 
 <suite>
-
+       
+       <ajc-test dir="bugs/privilege"
+               title="omnibus privileged access"
+               comment="from mail ~Problem with interfaces...~; add pr when bug submitted"
+               >
+               <compile files="packageProtected/concern/ContextUser.java,
+                                   packageProtected/concern/BaseTarget.java,
+                                   packageProtected/core/Base.java"/>
+               <run class="packageProtected.core.Base"/>
+               <run class="packageProtected.concern.BaseTarget"/>
+               </ajc-test>
+               
        <ajc-test dir="bugs"
                title="after returning type incompatible with join point return type"
                pr="42668"
diff --git a/tests/bugs/privilege/packageProtected/concern/BaseTarget.java b/tests/bugs/privilege/packageProtected/concern/BaseTarget.java
new file mode 100644 (file)
index 0000000..b8dd795
--- /dev/null
@@ -0,0 +1,54 @@
+package packageProtected.concern;
+
+public class BaseTarget {
+
+    // ---- same as Base
+    int default_int;
+    public int public_int;
+    protected int protected_int;
+    private int private_int;
+
+    void default_method() { }
+    public void public_method() { }
+    protected void protected_method() { }
+    private void private_method() { }
+    
+    void default_method(Object unused) { }
+    public void public_method(Object unused) { }
+    protected void protected_method(Object unused) { }
+    private void private_method(Object unused) { }
+
+    void default_method(Object unused, Object second) { }
+    public void public_method(Object unused, Object second) { }
+    protected void protected_method(Object unused, Object second) { }
+    private void private_method(Object unused, Object second) { }
+
+    static int default_staticInt;
+    public static int public_staticInt;
+    protected static int protected_staticInt;
+    private static int private_staticInt;
+
+    static void default_staticMethod() { }
+    public static void public_staticMethod() { }
+    protected static void protected_staticMethod() { }
+    private static void private_staticMethod() { }
+    
+    static void default_staticMethod(Object unused) { }
+    public static void public_staticMethod(Object unused) { }
+    protected static void protected_staticMethod(Object unused) { }
+    private static void private_staticMethod(Object unused) { }
+
+    static void default_staticMethod(Object unused, Object second) { }
+    public static void public_staticMethod(Object unused, Object second) { }
+    protected static void protected_staticMethod(Object unused, Object second) { }
+    private static void private_staticMethod(Object unused, Object second) { }
+    // ---- end of same as Base
+
+
+    public void trigger(BaseTarget me) {
+    }
+    public static void main(String[] args) {
+        BaseTarget user = new BaseTarget();
+        user.trigger(new BaseTarget());
+    }
+}
diff --git a/tests/bugs/privilege/packageProtected/concern/ContextUser.java b/tests/bugs/privilege/packageProtected/concern/ContextUser.java
new file mode 100644 (file)
index 0000000..b9571f6
--- /dev/null
@@ -0,0 +1,95 @@
+package packageProtected.concern;
+
+import packageProtected.core.Base;
+
+/** @testcase PR#XXX omnibus privileged access */
+public privileged aspect ContextUser {
+   pointcut call2trigger(Base argument):
+      execution(* Base.trigger(..))
+      && args(argument);
+      
+   before(Base base): call2trigger(base) {
+      int i = base.private_int 
+        + base.default_int
+       + base.protected_int
+       + base.public_int;
+      base.private_method();
+      base.default_method();
+      base.protected_method(); 
+      base.public_method();
+
+      base.private_method(null);
+      base.default_method(null);
+      base.protected_method(null); 
+      base.public_method(null);
+
+      base.private_method(null, null);
+      base.default_method(null, null);
+      base.protected_method(null, null); 
+      base.public_method(null, null);
+
+
+      i = Base.private_staticInt 
+        + Base.default_staticInt
+       + Base.protected_staticInt
+       + Base.public_staticInt;
+      Base.private_staticMethod();
+      Base.default_staticMethod();
+      Base.protected_staticMethod(); 
+      Base.public_staticMethod();
+
+      Base.private_staticMethod(null);
+      Base.default_staticMethod(null);
+      Base.protected_staticMethod(null); 
+      Base.public_staticMethod(null);
+
+      Base.private_staticMethod(null, null);
+      Base.default_staticMethod(null, null);
+      Base.protected_staticMethod(null, null); 
+      Base.public_staticMethod(null, null);
+   }  
+   pointcut call2trigger_samePackage(BaseTarget arg):
+      execution(* BaseTarget.trigger(..))
+      && args(arg);
+   
+   before(BaseTarget base): call2trigger_samePackage(base) {
+      
+      int i = base.private_int 
+        + base.default_int
+       + base.protected_int
+       + base.public_int;
+      base.private_method();
+      base.default_method();
+      base.protected_method(); 
+      base.public_method();
+
+      base.private_method(null);
+      base.default_method(null);
+      base.protected_method(null); 
+      base.public_method(null);
+
+      base.private_method(null, null);
+      base.default_method(null, null);
+      base.protected_method(null, null); 
+      base.public_method(null, null);
+
+      i = BaseTarget.private_staticInt 
+        + BaseTarget.default_staticInt
+       + BaseTarget.protected_staticInt
+       + BaseTarget.public_staticInt;
+      BaseTarget.private_staticMethod();
+      BaseTarget.default_staticMethod();
+      BaseTarget.protected_staticMethod(); 
+      BaseTarget.public_staticMethod();
+
+      BaseTarget.private_staticMethod(null);
+      BaseTarget.default_staticMethod(null);
+      BaseTarget.protected_staticMethod(null); 
+      BaseTarget.public_staticMethod(null);
+
+      BaseTarget.private_staticMethod(null, null);
+      BaseTarget.default_staticMethod(null, null);
+      BaseTarget.protected_staticMethod(null, null); 
+      BaseTarget.public_staticMethod(null, null);
+   }  
+}
\ No newline at end of file
diff --git a/tests/bugs/privilege/packageProtected/core/Base.java b/tests/bugs/privilege/packageProtected/core/Base.java
new file mode 100644 (file)
index 0000000..f2fafd0
--- /dev/null
@@ -0,0 +1,51 @@
+package packageProtected.core;
+
+public class Base {
+    int default_int;
+    public int public_int;
+    protected int protected_int;
+    private int private_int;
+
+    void default_method() { }
+    public void public_method() { }
+    protected void protected_method() { }
+    private void private_method() { }
+    
+    void default_method(Object unused) { }
+    public void public_method(Object unused) { }
+    protected void protected_method(Object unused) { }
+    private void private_method(Object unused) { }
+
+    void default_method(Object unused, Object second) { }
+    public void public_method(Object unused, Object second) { }
+    protected void protected_method(Object unused, Object second) { }
+    private void private_method(Object unused, Object second) { }
+
+    static int default_staticInt;
+    public static int public_staticInt;
+    protected static int protected_staticInt;
+    private static int private_staticInt;
+
+    static void default_staticMethod() { }
+    public static void public_staticMethod() { }
+    protected static void protected_staticMethod() { }
+    private static void private_staticMethod() { }
+    
+    static void default_staticMethod(Object unused) { }
+    public static void public_staticMethod(Object unused) { }
+    protected static void protected_staticMethod(Object unused) { }
+    private static void private_staticMethod(Object unused) { }
+
+    static void default_staticMethod(Object unused, Object second) { }
+    public static void public_staticMethod(Object unused, Object second) { }
+    protected static void protected_staticMethod(Object unused, Object second) { }
+    private static void private_staticMethod(Object unused, Object second) { }
+
+
+    public void trigger(Base me) {
+    }
+    public static void main(String[] args) {
+        Base user = new Base();
+        user.trigger(new Base());
+    }
+}