aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2006-05-17 11:38:39 +0000
committeraclement <aclement>2006-05-17 11:38:39 +0000
commit5f6a6b12c560f80dd720a943c4c63cf8dc182cc3 (patch)
treef84c6f2c0b932ae8ea3d28c06b12b35fcd98bb7b
parent7d9a7287ee1aef66ba2edf55ef2fec2bf95b0dc3 (diff)
downloadaspectj-5f6a6b12c560f80dd720a943c4c63cf8dc182cc3.tar.gz
aspectj-5f6a6b12c560f80dd720a943c4c63cf8dc182cc3.zip
test and fix for 141956
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java7
-rw-r--r--tests/multiIncremental/PR141956/base/A.java10
-rw-r--r--tests/multiIncremental/PR141956/base/C.java8
-rw-r--r--tests/multiIncremental/PR141956/inc1/C.java8
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java25
-rw-r--r--weaver/src/org/aspectj/weaver/ResolvedType.java2
6 files changed, 57 insertions, 3 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
index a2b86ca06..bab4080c0 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
@@ -76,6 +76,7 @@ import org.aspectj.weaver.UnresolvedType.TypeKind;
*/
public class EclipseFactory {
public static boolean DEBUG = false;
+ public static int debug_mungerCount = -1;
private AjBuildManager buildManager;
private LookupEnvironment lookupEnvironment;
@@ -410,8 +411,10 @@ public class EclipseFactory {
// XXX by Andy: why do we mix up the mungers here? it means later we know about two sets
// and the late ones are a subset of the complete set? (see pr114436)
- baseTypeMungers.addAll(getWorld().getCrosscuttingMembersSet().getLateTypeMungers());
-
+ // XXX by Andy removed this line finally, see pr141956
+ // baseTypeMungers.addAll(getWorld().getCrosscuttingMembersSet().getLateTypeMungers());
+ debug_mungerCount=baseTypeMungers.size();
+
for (Iterator i = baseTypeMungers.iterator(); i.hasNext(); ) {
ConcreteTypeMunger munger = (ConcreteTypeMunger) i.next();
EclipseTypeMunger etm = makeEclipseTypeMunger(munger);
diff --git a/tests/multiIncremental/PR141956/base/A.java b/tests/multiIncremental/PR141956/base/A.java
new file mode 100644
index 000000000..2cfd92ebf
--- /dev/null
+++ b/tests/multiIncremental/PR141956/base/A.java
@@ -0,0 +1,10 @@
+import org.aspectj.lang.annotation.*;
+
+@Aspect
+public class A {
+
+ @Before("within(C) && call(* foo(..))")
+ public void touchBeforeExecute() {
+ System.err.println("foo called");
+ }
+} \ No newline at end of file
diff --git a/tests/multiIncremental/PR141956/base/C.java b/tests/multiIncremental/PR141956/base/C.java
new file mode 100644
index 000000000..23fbdd7d2
--- /dev/null
+++ b/tests/multiIncremental/PR141956/base/C.java
@@ -0,0 +1,8 @@
+public class C {
+ public static void main(String[] args) {
+ new C().foo();
+ }
+ public void foo() {
+ System.err.println("foo running");
+ }
+} \ No newline at end of file
diff --git a/tests/multiIncremental/PR141956/inc1/C.java b/tests/multiIncremental/PR141956/inc1/C.java
new file mode 100644
index 000000000..23fbdd7d2
--- /dev/null
+++ b/tests/multiIncremental/PR141956/inc1/C.java
@@ -0,0 +1,8 @@
+public class C {
+ public static void main(String[] args) {
+ new C().foo();
+ }
+ public void foo() {
+ System.err.println("foo running");
+ }
+} \ 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 7958f6a0d..4cba5106a 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
@@ -23,6 +23,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory;
import org.aspectj.ajdt.internal.core.builder.AjState;
import org.aspectj.ajdt.internal.core.builder.AsmHierarchyBuilder;
import org.aspectj.ajdt.internal.core.builder.IncrementalStateManager;
@@ -620,6 +621,30 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
}
+ /**
+ * Checks we aren't leaking mungers across compiles (accumulating multiple instances of the same one that
+ * all do the same thing). On the first compile the munger is added late on - so at the time we set
+ * the count it is still zero. On the subsequent compiles we know about this extra one.
+ */
+ public void testPr141956_IncrementallyCompilingAtAj() {
+ initialiseProject("PR141956");
+ build("PR141956");
+ assertTrue("Should be zero but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==0);
+ alter("PR141956","inc1");
+ build("PR141956");
+ assertTrue("Should be only one but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==1);
+ alter("PR141956","inc1");
+ build("PR141956");
+ assertTrue("Should be only one but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==1);
+ alter("PR141956","inc1");
+ build("PR141956");
+ assertTrue("Should be only one but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==1);
+ alter("PR141956","inc1");
+ build("PR141956");
+ assertTrue("Should be only one but reports "+EclipseFactory.debug_mungerCount,EclipseFactory.debug_mungerCount==1);
+ }
+
+
// public void testPr124399() {
// AjdeInteractionTestbed.VERBOSE=true;
// configureBuildStructureModel(true);
diff --git a/weaver/src/org/aspectj/weaver/ResolvedType.java b/weaver/src/org/aspectj/weaver/ResolvedType.java
index 84da56906..243b35330 100644
--- a/weaver/src/org/aspectj/weaver/ResolvedType.java
+++ b/weaver/src/org/aspectj/weaver/ResolvedType.java
@@ -285,7 +285,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
boolean shouldSkip = false;
for (int j = 0; j < rtx.interTypeMungers.size(); j++) {
ConcreteTypeMunger munger = (ConcreteTypeMunger) rtx.interTypeMungers.get(j);
- if (munger.getMunger().getKind() == ResolvedTypeMunger.Parent) {
+ if (munger.getMunger()!=null && munger.getMunger().getKind() == ResolvedTypeMunger.Parent) {
shouldSkip = true;
break;
}