diff options
author | aclement <aclement> | 2005-06-07 12:17:30 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-06-07 12:17:30 +0000 |
commit | 3824b1c24717b79d48bd5f965bd2d34569dc2195 (patch) | |
tree | 8ff1f27023a8fa71d38e8989300e827177a45cc2 | |
parent | 28dfbdae5135a0324471c846f0ca1690245cb671 (diff) | |
download | aspectj-3824b1c24717b79d48bd5f965bd2d34569dc2195.tar.gz aspectj-3824b1c24717b79d48bd5f965bd2d34569dc2195.zip |
Fix and tests for PR94167: NPE in reflection API. Fix submitted by Ron Bodkin.
-rw-r--r-- | lib/aspectj/lib/aspectjrt.jar | bin | 68675 -> 73096 bytes | |||
-rw-r--r-- | lib/test/aspectjrt.jar | bin | 71688 -> 73096 bytes | |||
-rw-r--r-- | runtime/src/org/aspectj/runtime/reflect/AdviceSignatureImpl.java | 2 | ||||
-rw-r--r-- | runtime/src/org/aspectj/runtime/reflect/MethodSignatureImpl.java | 2 | ||||
-rw-r--r-- | tests/bugs150/PR94167.java | 26 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java | 6 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 5 |
7 files changed, 38 insertions, 3 deletions
diff --git a/lib/aspectj/lib/aspectjrt.jar b/lib/aspectj/lib/aspectjrt.jar Binary files differindex 0f28a7e19..03cb6fba1 100644 --- a/lib/aspectj/lib/aspectjrt.jar +++ b/lib/aspectj/lib/aspectjrt.jar diff --git a/lib/test/aspectjrt.jar b/lib/test/aspectjrt.jar Binary files differindex cae13dcf0..03cb6fba1 100644 --- a/lib/test/aspectjrt.jar +++ b/lib/test/aspectjrt.jar diff --git a/runtime/src/org/aspectj/runtime/reflect/AdviceSignatureImpl.java b/runtime/src/org/aspectj/runtime/reflect/AdviceSignatureImpl.java index e814a5add..6bf899a22 100644 --- a/runtime/src/org/aspectj/runtime/reflect/AdviceSignatureImpl.java +++ b/runtime/src/org/aspectj/runtime/reflect/AdviceSignatureImpl.java @@ -62,7 +62,7 @@ class AdviceSignatureImpl extends CodeSignatureImpl implements AdviceSignature { public Method getAdvice() { if (adviceMethod == null) { try { - adviceMethod = declaringType.getDeclaredMethod(getName(),getParameterTypes()); + adviceMethod = getDeclaringType().getDeclaredMethod(getName(),getParameterTypes()); } catch (Exception ex) { ; // nothing we can do, caller will see null } diff --git a/runtime/src/org/aspectj/runtime/reflect/MethodSignatureImpl.java b/runtime/src/org/aspectj/runtime/reflect/MethodSignatureImpl.java index 3331df08d..612d0ca0e 100644 --- a/runtime/src/org/aspectj/runtime/reflect/MethodSignatureImpl.java +++ b/runtime/src/org/aspectj/runtime/reflect/MethodSignatureImpl.java @@ -60,7 +60,7 @@ class MethodSignatureImpl extends CodeSignatureImpl implements MethodSignature { public Method getMethod() { if (method == null) { try { - method = declaringType.getDeclaredMethod(getName(),getParameterTypes()); + method = getDeclaringType().getDeclaredMethod(getName(),getParameterTypes()); } catch (NoSuchMethodException nsmEx) { ; // nothing we can do, user will see null return } diff --git a/tests/bugs150/PR94167.java b/tests/bugs150/PR94167.java new file mode 100644 index 000000000..b71f3dd59 --- /dev/null +++ b/tests/bugs150/PR94167.java @@ -0,0 +1,26 @@ +package reflect; + +import org.aspectj.lang.*; +import org.aspectj.lang.reflect.*; +import java.lang.reflect.*; + +aspect Test { + before() : call(* *(..)) && !within(Test) { + MethodSignature sig = (MethodSignature)thisJoinPoint.getSignature(); + //sig.getDeclaringType(); // uncomment to work-around + Method method = sig.getMethod(); + } +} + +public class PR94167 { + public static void main(String args[]) { + try { + Inner.foo(); + } catch (Throwable t) { + t.printStackTrace(); + } + } + public static class Inner { + public static void foo() {} + } +}
\ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java index 919621e80..7ee575f19 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -170,10 +170,14 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { * IfPointcut.findResidueInternal() was modified to make this test complete in a short amount * of time - if you see it hanging, someone has messed with the optimization. */ - public void testIfEvaluationExplosiion_PR94086() { + public void testIfEvaluationExplosion_pr94086() { runTest("Exploding compile time with if() statements in pointcut"); } + public void testReflectNPE_pr94167() { + runTest("NPE in reflect implementation"); + } + // helper methods..... public SyntheticRepository createRepos(File cpentry) { diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 94994b90a..863c39dae 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -1065,6 +1065,11 @@ <message kind="warning" line="7" text="advice defined in AnAspect has not been applied [Xlint:adviceDidNotMatch]"/> </compile> </ajc-test> + + <ajc-test dir="bugs150" title="NPE in reflect implementation" pr="94167"> + <compile files="PR94167.java"/> + <run class="reflect.PR94167"/> + </ajc-test> <!-- ======================================================================================= --> <!-- annotated aspect members --> |