static String message = "-advised";
String around(String s):
- call(String doIt(String)) && args(s) &&
- (target(packagevisibility.testPackage.Class1) ||
- target(packagevisibility.testPackage.Class2)) {
+ call(String doIt(String)) && args(s) {
String result = s + message;
result += A1.message;
return result + proceed(s);
--- /dev/null
+package packagevisibility;
+import org.aspectj.testing.Tester;
+
+import packagevisibility.testPackage.*;
+
+public class PackagesAndAdviceCf
+{
+ public static void main(String[] args) { test(); }
+
+ public static void test() {
+ packagevisibility.testPackage.Class1 c1 =
+ new packagevisibility.testPackage.Class1();
+ Tester.checkEqual(c1.doIt("-1"),
+ "-1-advised-advised1-1-class1",
+ "publically visible");
+ Tester.checkEqual(c1.doItToClass2("-2"),
+ "-2-advised-advised1-2-class2",
+ "package visible");
+ }
+
+}
+
+aspect A {
+ static String message = "-advised";
+
+ String around(String s):
+ call(String doIt(String)) && args(s) &&
+ (target(packagevisibility.testPackage.Class1) ||
+ target(packagevisibility.testPackage.Class2)) { // Cf type not visible
+ String result = s + message;
+ result += A1.message;
+ return result + proceed(s);
+ }
+
+}
+
+class A1 {
+ static String message = "-advised1";
+}
import org.aspectj.testing.*;
-public class ChildCE {
+public class ChildCE implements I {
public static void main (String[] args) {
new Target().run();
Tester.checkAllEvents();
}
}
+interface I {
+ public pointcut fromInterface(): call(* *(..));
+}
+
class Target {
public void run(){
Tester.event("run");
}
/** @testcase PR#647 concrete aspect unable to access abstract package-private pointcut in parent for overriding */
-aspect ParentChild extends ParentCE {// expect CE here: child does not define "define()" b/c inaccessible
+aspect ParentChild extends ParentCE implements I {// expect CE here: child does not define "define()" b/c inaccessible
protected pointcut define()
: call(public void Target.run());
}
/** @testcase PR#647 concrete aspect unable to access abstract package-private pointcut in parent for overriding */
public abstract aspect ParentCE {
abstract pointcut define();
+
+ public abstract pointcut fromInterface();
+
+ pointcut withSig(int i): args(i);
+
before() : define() {
Tester.event("define");
}
}
aspect Child extends ParentCE {
pointcut define() : call(public void Runnable.run());
+ public pointcut fromInterface(): call(* *(..));
+
+ pointcut withSig(): args(); // should be CE incompatible params
}