From 1535ee721c16509713642e20316b226ece69fda9 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 19 Apr 2006 13:36:39 +0000 Subject: [PATCH] test and fix for 136585: NullPointerException in PerObjectInterfaceTypeMunger.java:33 --- tests/multiIncremental/PR136585/base/Aspect.aj | 3 +++ tests/multiIncremental/PR136585/base/Hello.java | 6 ++++++ tests/multiIncremental/PR136585/inc1/Aspect.aj | 3 +++ .../incremental/tools/MultiProjectIncrementalTests.java | 9 +++++++++ .../org/aspectj/weaver/PerObjectInterfaceTypeMunger.java | 6 +++--- 5 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 tests/multiIncremental/PR136585/base/Aspect.aj create mode 100644 tests/multiIncremental/PR136585/base/Hello.java create mode 100644 tests/multiIncremental/PR136585/inc1/Aspect.aj diff --git a/tests/multiIncremental/PR136585/base/Aspect.aj b/tests/multiIncremental/PR136585/base/Aspect.aj new file mode 100644 index 000000000..9fe594ec3 --- /dev/null +++ b/tests/multiIncremental/PR136585/base/Aspect.aj @@ -0,0 +1,3 @@ +public aspect Aspect perthis(staticinitialization(Hello)) { + +} \ No newline at end of file diff --git a/tests/multiIncremental/PR136585/base/Hello.java b/tests/multiIncremental/PR136585/base/Hello.java new file mode 100644 index 000000000..13b7c1864 --- /dev/null +++ b/tests/multiIncremental/PR136585/base/Hello.java @@ -0,0 +1,6 @@ +public class Hello { + + public static void main(String[] args) { + System.err.println("Hello"); + } +} \ No newline at end of file diff --git a/tests/multiIncremental/PR136585/inc1/Aspect.aj b/tests/multiIncremental/PR136585/inc1/Aspect.aj new file mode 100644 index 000000000..7644bf5e8 --- /dev/null +++ b/tests/multiIncremental/PR136585/inc1/Aspect.aj @@ -0,0 +1,3 @@ +public aspect Aspect perthis(staticinitialization(Hello)) { + public void foo() {} +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index c6f6672a5..a5bd9edc1 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -821,6 +821,15 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed { checkXMLAspectCount("PR131505","A",1); checkXMLAspectCount("PR131505","pkg.A",1); } + + public void testPr136585() { + initialiseProject("PR136585"); + build("PR136585"); + alter("PR136585","inc1"); + build("PR136585"); + assertTrue("There should be no errors reported:\n"+MyTaskListManager.getErrorMessages(), + MyTaskListManager.getErrorMessages().isEmpty()); + } public void testPr133532() { initialiseProject("PR133532"); diff --git a/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java b/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java index 6f473c749..219ad3277 100644 --- a/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java @@ -28,10 +28,10 @@ public class PerObjectInterfaceTypeMunger extends ResolvedTypeMunger { private TypePattern lazyTestTypePattern; public boolean equals(Object other) { - if (!(other instanceof PerObjectInterfaceTypeMunger)) return false; + if (other==null || !(other instanceof PerObjectInterfaceTypeMunger)) return false; PerObjectInterfaceTypeMunger o = (PerObjectInterfaceTypeMunger)other; - return ((o.testPointcut == null) ? (testPointcut == null ) : testPointcut.equals(o.testPointcut)) - && ((o.lazyTestTypePattern == null) ? (lazyTestTypePattern == null ) : lazyTestTypePattern.equals(o.lazyTestTypePattern)); + return ((testPointcut == null) ? (o.testPointcut == null ) : testPointcut.equals(o.testPointcut)) + && ((lazyTestTypePattern == null) ? (o.lazyTestTypePattern == null ) : lazyTestTypePattern.equals(o.lazyTestTypePattern)); } private volatile int hashCode = 0; -- 2.39.5