diff options
-rw-r--r-- | tests/bugs163/pr154427/Authorization.java | 4 | ||||
-rw-r--r-- | tests/bugs163/pr154427/AuthorizationAdmin.java | 4 | ||||
-rw-r--r-- | tests/bugs163/pr154427/AuthorizationImpl.java | 18 | ||||
-rw-r--r-- | tests/bugs163/pr154427/CallAndMethodSignatureAspect.java | 21 | ||||
-rw-r--r-- | tests/bugs163/pr154427/CallTest.java | 36 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java | 4 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc163/ajc163.xml | 17 |
7 files changed, 104 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(); + } + +} + diff --git a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java index 48b904560..60fe1616f 100644 --- a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java @@ -28,6 +28,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testGetMethodNull_pr154427() { + runTest("getMethod returning null"); + } + public void testFQType_pr256937() { runTest("fully qualified return type"); IHierarchy top = AsmManager.lastActiveStructureModel.getHierarchy(); diff --git a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml index a35e25473..400923d5a 100644 --- a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml +++ b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml @@ -2,6 +2,23 @@ <suite> + <ajc-test dir="bugs163/pr154427" title="getMethod returning null"> + <compile files="AuthorizationImpl.java Authorization.java AuthorizationAdmin.java CallAndMethodSignatureAspect.java CallTest.java" options=""/> + <run class="CallTest"> + <stdout> + <line text="public abstract boolean Authorization.mayPerform(java.lang.String,java.lang.String)"/> + <line text="public abstract interface boolean AuthorizationAdmin.mayPerform(java.lang.String, java.lang.String)"/> + <line text="mayPerform() executing"/> + <line text="public abstract boolean AuthorizationAdmin.mayPerform2(java.lang.String,java.lang.String)"/> + <line text="public abstract interface boolean AuthorizationAdmin.mayPerform2(java.lang.String, java.lang.String)"/> + <line text="mayPerform2() executing"/> + <line text="public abstract boolean Authorization.mayPerform(java.lang.String,java.lang.String)"/> + <line text="public abstract interface boolean Authorization.mayPerform(java.lang.String, java.lang.String)"/> + <line text="mayPerform() executing"/> + </stdout> + </run> + </ajc-test> + <ajc-test dir="bugs163/pr256937" title="fully qualified return type"> <compile files="Ship.java ShipAccessor.java" options="-emacssym -1.5"/> </ajc-test> |