aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs163
diff options
context:
space:
mode:
authoraclement <aclement>2008-12-01 19:02:43 +0000
committeraclement <aclement>2008-12-01 19:02:43 +0000
commit5dcfe73f9b4e4bd5544aeb43adb9df05fd11885c (patch)
tree85c1b4f75e544ef9f3f13a66fbf5162d35e2343d /tests/bugs163
parent3a996832d394faf409bbca5bef7846256bb3592d (diff)
downloadaspectj-5dcfe73f9b4e4bd5544aeb43adb9df05fd11885c.tar.gz
aspectj-5dcfe73f9b4e4bd5544aeb43adb9df05fd11885c.zip
154427: test and fix
Diffstat (limited to 'tests/bugs163')
-rw-r--r--tests/bugs163/pr154427/Authorization.java4
-rw-r--r--tests/bugs163/pr154427/AuthorizationAdmin.java4
-rw-r--r--tests/bugs163/pr154427/AuthorizationImpl.java18
-rw-r--r--tests/bugs163/pr154427/CallAndMethodSignatureAspect.java21
-rw-r--r--tests/bugs163/pr154427/CallTest.java36
5 files changed, 83 insertions, 0 deletions
diff --git a/tests/bugs163/pr154427/Authorization.java b/tests/bugs163/pr154427/Authorization.java
new file mode 100644
index 000000000..76553f938
--- /dev/null
+++ b/tests/bugs163/pr154427/Authorization.java
@@ -0,0 +1,4 @@
+public interface Authorization {
+ boolean mayPerform(String user, String action);
+}
+
diff --git a/tests/bugs163/pr154427/AuthorizationAdmin.java b/tests/bugs163/pr154427/AuthorizationAdmin.java
new file mode 100644
index 000000000..a8509f4a0
--- /dev/null
+++ b/tests/bugs163/pr154427/AuthorizationAdmin.java
@@ -0,0 +1,4 @@
+public interface AuthorizationAdmin extends Authorization {
+ boolean mayPerform2(String user, String action);
+}
+
diff --git a/tests/bugs163/pr154427/AuthorizationImpl.java b/tests/bugs163/pr154427/AuthorizationImpl.java
new file mode 100644
index 000000000..010a46e2c
--- /dev/null
+++ b/tests/bugs163/pr154427/AuthorizationImpl.java
@@ -0,0 +1,18 @@
+public class AuthorizationImpl implements AuthorizationAdmin {
+
+ /* ========== interface Authorization ============*/
+
+ public boolean mayPerform(String user, String action) {
+ System.out.println("mayPerform() executing");
+ return true;
+ }
+
+ /* ========== interface AuthorizationAdmin ============*/
+
+ public boolean mayPerform2(String user, String action) {
+ System.out.println("mayPerform2() executing");
+ return true;
+ }
+
+}
+
diff --git a/tests/bugs163/pr154427/CallAndMethodSignatureAspect.java b/tests/bugs163/pr154427/CallAndMethodSignatureAspect.java
new file mode 100644
index 000000000..2f8e8cf86
--- /dev/null
+++ b/tests/bugs163/pr154427/CallAndMethodSignatureAspect.java
@@ -0,0 +1,21 @@
+import org.aspectj.lang.reflect.*;
+import java.lang.reflect.*;
+
+public aspect CallAndMethodSignatureAspect {
+
+ pointcut callAnyPublicMethodInAuthorization() : call(public * Authorization+.*(..) );
+
+ Object around() : callAnyPublicMethodInAuthorization() {
+
+ MethodSignature methodSignature = (MethodSignature) thisJoinPoint.getSignature();
+
+ // returns NULL when calling a method defined in the top interface "Authorization"
+ Method method = methodSignature.getMethod();
+
+ System.out.println(method);
+ System.out.println(methodSignature.toLongString());
+
+ return proceed();
+ }
+}
+
diff --git a/tests/bugs163/pr154427/CallTest.java b/tests/bugs163/pr154427/CallTest.java
new file mode 100644
index 000000000..8c1ea5036
--- /dev/null
+++ b/tests/bugs163/pr154427/CallTest.java
@@ -0,0 +1,36 @@
+public class CallTest {
+
+
+ public static void main(String[]argv) {
+ new CallTest().testMayPerform();
+ new CallTest().testMayPerform2();
+ new CallTest().testMayPerform3();
+ }
+
+ private AuthorizationAdmin admin;
+ private Authorization auth;
+
+ public void testMayPerform() {
+ admin = new AuthorizationImpl();
+ boolean bool = admin.mayPerform("peter", "query");
+ if (!bool) throw new RuntimeException();
+ }
+
+ public void testMayPerform2() {
+ admin = new AuthorizationImpl();
+
+ boolean bool = admin.mayPerform2("peter2", "query2");
+ if (!bool) throw new RuntimeException();
+
+ }
+
+ public void testMayPerform3() {
+ auth = new AuthorizationImpl();
+
+ boolean bool = auth.mayPerform("peter2", "query2");
+
+ if (!bool) throw new RuntimeException();
+ }
+
+}
+