@@ -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 | |||
} |
@@ -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 | |||
} |
@@ -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() {} | |||
} | |||
} |
@@ -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) { |
@@ -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 --> |