From ba42a09551519a4b611ab06edb161ecb0c629f53 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 21 Feb 2006 15:55:33 +0000 Subject: [PATCH] test and fix for 128237 from Helen --- tests/bugs151/pr128237.java | 29 +++++++++++++++++++ .../systemtest/ajc151/Ajc151Tests.java | 4 +++ .../org/aspectj/systemtest/ajc151/ajc151.xml | 4 +++ .../org/aspectj/weaver/bcel/BcelWeaver.java | 6 +++- 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 tests/bugs151/pr128237.java diff --git a/tests/bugs151/pr128237.java b/tests/bugs151/pr128237.java new file mode 100644 index 000000000..93af416c8 --- /dev/null +++ b/tests/bugs151/pr128237.java @@ -0,0 +1,29 @@ +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.annotation.Pointcut; + +@Aspect +class AbstractTracer +{ + + @Pointcut("(execution(public * Foo.anotherMethod*(..)) || execution(public * Foo.methodA(..))) && this(obj)") + protected void methodExec(Object obj){}; + + @Before("methodExec(obj)") + public void beforeMethodExec(JoinPoint thisJoinPoint, Object obj) { + System.out.println("Before " + thisJoinPoint.getSignature().toString()); + } + +} + + +class Foo { + + public void methodA() { + } + + public void anotherMethod() { + } + +} diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java index 0832c4a47..2672caa3e 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java @@ -170,6 +170,10 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase { runTest("@AJ declare parents retains field state"); } + public void testAtAspectNoNPEWithPcdContainingOrThisAndWildcard_pr128237() { + runTest("@AJ no npe with pointcut containing or, this and a wildcard"); + } + /* * Load-time weaving bugs and enhancements */ diff --git a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml index c76ccbac7..d340d0778 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml +++ b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml @@ -208,6 +208,10 @@ + + + + diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index 118e7bfee..31dbacd0a 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -611,7 +611,11 @@ public class BcelWeaver implements IWeaver { // if each branch binds it in exactly the same way... List ambiguousNames = new ArrayList(); for (int i = 0; i < numFormals; i++) { - if (!leftBindings[i].equals(rightBindings[i])) { + if (leftBindings[i] == null) { + if (rightBindings[i] != null) { + ambiguousNames.add(names[i]); + } + } else if (!leftBindings[i].equals(rightBindings[i])) { ambiguousNames.add(names[i]); } } -- 2.39.5