summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2010-07-21 21:28:52 +0000
committeraclement <aclement>2010-07-21 21:28:52 +0000
commitb3a2c080204f65a6dc653926c230f74723925a30 (patch)
tree7961b3e32911caecefbc47b9dc5abb534b3abac9 /tests
parent883ae88ebade558388f349ade9d356d99ca0b4cd (diff)
downloadaspectj-b3a2c080204f65a6dc653926c230f74723925a30.tar.gz
aspectj-b3a2c080204f65a6dc653926c230f74723925a30.zip
278496: model deletion, allow for inner aspects
Diffstat (limited to 'tests')
-rw-r--r--tests/multiIncremental/PR278496_4/base/src/foo/MyClass.java20
-rw-r--r--tests/multiIncremental/PR278496_4/base/src/foo/MyOtherClass.java17
-rw-r--r--tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java7
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java39
4 files changed, 78 insertions, 5 deletions
diff --git a/tests/multiIncremental/PR278496_4/base/src/foo/MyClass.java b/tests/multiIncremental/PR278496_4/base/src/foo/MyClass.java
new file mode 100644
index 000000000..829bff4a8
--- /dev/null
+++ b/tests/multiIncremental/PR278496_4/base/src/foo/MyClass.java
@@ -0,0 +1,20 @@
+package foo;
+
+/**
+ * @author Sian
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class MyClass {
+
+
+ public static void main(String[] args) {
+
+ }
+
+ public void method1() {}
+
+ public void method2() {}
+}
+
diff --git a/tests/multiIncremental/PR278496_4/base/src/foo/MyOtherClass.java b/tests/multiIncremental/PR278496_4/base/src/foo/MyOtherClass.java
new file mode 100644
index 000000000..655faacd5
--- /dev/null
+++ b/tests/multiIncremental/PR278496_4/base/src/foo/MyOtherClass.java
@@ -0,0 +1,17 @@
+package foo;
+public class MyOtherClass {
+
+ public static class MyInnerClass {
+
+ public static aspect MyInnerInnerAspect {
+
+ before(): execution(* MyClass.method1()) {
+ System.out.println("Before method1..");
+ }
+
+ }
+
+ }
+
+}
+
diff --git a/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java b/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java
index 6090458ab..fd7f57dd0 100644
--- a/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java
@@ -17,6 +17,7 @@ import org.aspectj.apache.bcel.classfile.JavaClass;
import org.aspectj.apache.bcel.util.ClassPath;
import org.aspectj.apache.bcel.util.SyntheticRepository;
import org.aspectj.asm.AsmManager;
+import org.aspectj.asm.IRelationshipMap;
import org.aspectj.testing.XMLBasedAjcTestCase;
/**
@@ -130,10 +131,12 @@ public class IntertypeTests extends org.aspectj.testing.XMLBasedAjcTestCase {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintWriter pw = new PrintWriter(baos);
AsmManager.dumptree(pw, AsmManager.lastActiveStructureModel.getHierarchy().getRoot(), 0);
- pw.write(AsmManager.lastActiveStructureModel.getRelationshipMap().toString());
+ IRelationshipMap irm = AsmManager.lastActiveStructureModel.getRelationshipMap();
+ pw.write(irm.toString());
pw.flush();
String model = baos.toString();
- assertTrue(model.indexOf("<{Choice.java[Choice=[aspect declarations], <{Choice.java}X[Keys=[declared on]") != -1);
+ assertTrue(model.indexOf("<{Choice.java[Choice=[aspect declarations]") != -1);
+ assertTrue(model.indexOf("<{Choice.java}X[Keys=[declared on]") != -1);
}
public void testGenerics1() throws Exception {
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
index a762bab06..7d8cb973d 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
@@ -210,7 +210,7 @@ public class IncrementalCompilationTests extends AbstractMultiProjectIncremental
AspectJElementHierarchy model = (AspectJElementHierarchy) getModelFor(p).getHierarchy();
// Node for "Code.java" should not be there:
- IProgramElement ipe = model.findElementForHandleOrCreate("=PR278496_1<a.b.c{Code.java",false);
+ IProgramElement ipe = model.findElementForHandleOrCreate("=PR278496_1<a.b.c{Code.java", false);
Assert.assertNull(ipe);
}
@@ -235,10 +235,43 @@ public class IncrementalCompilationTests extends AbstractMultiProjectIncremental
// Hid:1:(targets=1) =PR278496_2<{Azpect.java}Azpect)Code.m (declared on) =PR278496_2<{Code.java[Code
// Hid:2:(targets=1) =PR278496_2<{Code.java[Code (aspect declarations) =PR278496_2<{Azpect.java}Azpect)Code.m
-
AspectJElementHierarchy model = (AspectJElementHierarchy) getModelFor(p).getHierarchy();
// Node for "Code.java" should be there since it is the target of a relationship
- IProgramElement ipe = model.findElementForHandleOrCreate("=PR278496_2<{Code.java",false);
+ IProgramElement ipe = model.findElementForHandleOrCreate("=PR278496_2<{Code.java", false);
+ Assert.assertNotNull(ipe);
+ }
+
+ public void testDeletionInnerAspects_278496_4() throws Exception {
+ String p = "PR278496_4";
+ initialiseProject(p);
+ configureNonStandardCompileOptions(p, "-Xset:minimalModel=true");
+ build(p);
+ checkWasFullBuild();
+ printModel(p);
+ // Here is the model without deletion.
+ // PR278496_4 [build configuration file] hid:=PR278496_4
+ // foo [package] hid:=PR278496_4<foo
+ // MyOtherClass.java [java source file] 1 hid:=PR278496_4<foo{MyOtherClass.java
+ // foo [package declaration] 1 hid:=PR278496_4<foo{MyOtherClass.java%foo
+ // [import reference] hid:=PR278496_4<foo{MyOtherClass.java#
+ // MyOtherClass [class] 2 hid:=PR278496_4<foo{MyOtherClass.java[MyOtherClass
+ // MyInnerClass [class] 4 hid:=PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass
+ // MyInnerInnerAspect [aspect] 6 hid:=PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass}MyInnerInnerAspect
+ // before(): <anonymous pointcut> [advice] 8 hid:=PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass}MyInnerInnerAspect&before
+ // MyClass.java [java source file] 1 hid:=PR278496_4<foo{MyClass.java
+ // foo [package declaration] 1 hid:=PR278496_4<foo{MyClass.java%foo
+ // [import reference] hid:=PR278496_4<foo{MyClass.java#
+ // MyClass [class] 9 hid:=PR278496_4<foo{MyClass.java[MyClass
+ // main(java.lang.String[]) [method] 12 hid:=PR278496_4<foo{MyClass.java[MyClass~main~\[QString;
+ // method1() [method] 16 hid:=PR278496_4<foo{MyClass.java[MyClass~method1
+ // method2() [method] 18 hid:=PR278496_4<foo{MyClass.java[MyClass~method2
+ // Hid:1:(targets=1) =PR278496_4<foo{MyClass.java[MyClass~method1 (advised by) =PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass}MyInnerInnerAspect&before
+ // Hid:2:(targets=1) =PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass}MyInnerInnerAspect&before (advises) =PR278496_4<foo{MyClass.java[MyClass~method1
+
+ AspectJElementHierarchy model = (AspectJElementHierarchy) getModelFor(p).getHierarchy();
+
+ IProgramElement ipe = model.findElementForHandleOrCreate(
+ "=PR278496_4<foo{MyOtherClass.java[MyOtherClass[MyInnerClass}MyInnerInnerAspect", false);
Assert.assertNotNull(ipe);
}
}