summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2008-12-12 17:14:00 +0000
committeraclement <aclement>2008-12-12 17:14:00 +0000
commitdb5cc21f2429dfa9b490d924997927dcfcc4952b (patch)
treeff330026fc6734593f6ed15f35221c89a992660f
parentbc71bf94320dbdba830261c0f115688d77a7592b (diff)
downloadaspectj-db5cc21f2429dfa9b490d924997927dcfcc4952b.tar.gz
aspectj-db5cc21f2429dfa9b490d924997927dcfcc4952b.zip
fq itds - tests
-rw-r--r--tests/multiIncremental/itdfq/base/src/A.java17
-rw-r--r--tests/multiIncremental/itdpe/base/test/Demo.aj12
-rw-r--r--tests/multiIncremental/itdpe/base/test/MyAspect.aj36
-rw-r--r--tests/multiIncremental/itdpe/base/test/OtherClass.aj9
-rw-r--r--tests/multiIncremental/itdpe/base/test2/MyAspect2.aj28
-rw-r--r--tests/multiIncremental/itdpe/base/test2/OtherClass2.aj13
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java82
7 files changed, 197 insertions, 0 deletions
diff --git a/tests/multiIncremental/itdfq/base/src/A.java b/tests/multiIncremental/itdfq/base/src/A.java
new file mode 100644
index 000000000..2e2478416
--- /dev/null
+++ b/tests/multiIncremental/itdfq/base/src/A.java
@@ -0,0 +1,17 @@
+package a.b.c;
+
+public class A {
+}
+
+aspect X {
+ B A.foo(C c) { return null; }
+ declare parents: A implements java.io.Serializable;
+}
+
+class B {}
+
+class C {}
+
+aspect XX {
+ public B.new(String s) {}
+}
diff --git a/tests/multiIncremental/itdpe/base/test/Demo.aj b/tests/multiIncremental/itdpe/base/test/Demo.aj
new file mode 100644
index 000000000..4a8355fd3
--- /dev/null
+++ b/tests/multiIncremental/itdpe/base/test/Demo.aj
@@ -0,0 +1,12 @@
+package test;
+
+
+public class Demo {
+
+ void g() {
+ new Demo(7).foo(null);
+ x++;
+ this.x++;
+ }
+
+}
diff --git a/tests/multiIncremental/itdpe/base/test/MyAspect.aj b/tests/multiIncremental/itdpe/base/test/MyAspect.aj
new file mode 100644
index 000000000..7b15897dc
--- /dev/null
+++ b/tests/multiIncremental/itdpe/base/test/MyAspect.aj
@@ -0,0 +1,36 @@
+package test;
+import java.util.List;
+
+public aspect MyAspect {
+ List<String> Demo.list = null;
+ int Demo.x = 5;
+
+ void Demo.foo(List<String> x) {
+
+ }
+
+ public Demo.new(int x) { }
+
+ declare warning : execution(* *.nothing(..)) : "blah";
+
+ declare error : execution(* *.nothing(..)) : "blah";
+
+ declare soft : Exception : execution(* *.nothing(..));
+
+
+ protected pointcut s():
+ call(String Demo.toString(..));
+
+ before (): s() {
+ }
+ after (): s() {
+ }
+ void around (): s() {
+ proceed();
+ return;
+ }
+ after () returning(): s() {
+ }
+ after () throwing(): s() {
+ }
+}
diff --git a/tests/multiIncremental/itdpe/base/test/OtherClass.aj b/tests/multiIncremental/itdpe/base/test/OtherClass.aj
new file mode 100644
index 000000000..2a24fd6f9
--- /dev/null
+++ b/tests/multiIncremental/itdpe/base/test/OtherClass.aj
@@ -0,0 +1,9 @@
+package test;
+
+public class OtherClass {
+ void x() {
+ Demo d = new Demo(4);
+ d.foo(null);
+ d.x ++;
+ }
+}
diff --git a/tests/multiIncremental/itdpe/base/test2/MyAspect2.aj b/tests/multiIncremental/itdpe/base/test2/MyAspect2.aj
new file mode 100644
index 000000000..8fd933a34
--- /dev/null
+++ b/tests/multiIncremental/itdpe/base/test2/MyAspect2.aj
@@ -0,0 +1,28 @@
+package test2;
+
+public aspect MyAspect2 {
+
+ static interface Bar {
+
+ }
+ static class Foo {
+ public Foo() {
+
+ }
+ }
+
+ // must use fully qualified names
+ declare parents : test.Demo implements test2.MyAspect2.Bar, Cloneable;
+
+ // must use fully qualified names
+ declare parents : test.Demo extends test2.MyAspect2.Foo;
+
+ int Bar.bar() {
+ return 7;
+ }
+
+ int Foo.baz() {
+ return 7;
+ }
+
+}
diff --git a/tests/multiIncremental/itdpe/base/test2/OtherClass2.aj b/tests/multiIncremental/itdpe/base/test2/OtherClass2.aj
new file mode 100644
index 000000000..052219d7e
--- /dev/null
+++ b/tests/multiIncremental/itdpe/base/test2/OtherClass2.aj
@@ -0,0 +1,13 @@
+package test2;
+
+import test.Demo;
+
+public class OtherClass2 {
+ void x() {
+ Demo d = new Demo(4);
+ ((MyAspect2.Bar) d).bar();
+ d.baz();
+
+ ((Cloneable) d).toString();
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
index d5760ad61..2cd1ca90b 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
@@ -19,6 +19,7 @@ import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.aspectj.ajde.core.ICompilerConfiguration;
@@ -30,6 +31,7 @@ import org.aspectj.asm.IHierarchy;
import org.aspectj.asm.IProgramElement;
import org.aspectj.asm.IRelationship;
import org.aspectj.asm.IRelationshipMap;
+import org.aspectj.asm.internal.ProgramElement;
import org.aspectj.asm.internal.Relationship;
import org.aspectj.bridge.IMessage;
import org.aspectj.tools.ajc.Ajc;
@@ -164,6 +166,86 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
checkCompileWeaveCount("Annos", 3, 3);
}
+
+ // package a.b.c;
+ //
+ // public class A {
+ // }
+ //
+ // aspect X {
+ // B A.foo(C c) { return null; }
+ // declare parents: A implements java.io.Serializable;
+ // }
+ //
+ // class B {}
+ // class C {}
+ public void testITDFQNames_pr252702() {
+ String p = "itdfq";
+ AjdeInteractionTestbed.VERBOSE = true;
+ initialiseProject(p);
+ build(p);
+ AsmManager model = getModelFor(p);
+ dumptree(model.getHierarchy().getRoot(), 0);
+ IProgramElement root = model.getHierarchy().getRoot();
+ ProgramElement theITD = (ProgramElement) findElementAtLine(root, 7);
+ Map m = theITD.kvpairs;
+ for (Iterator iterator = m.keySet().iterator(); iterator.hasNext();) {
+ String type = (String) iterator.next();
+ System.out.println(type + " = " + m.get(type));
+ }
+ // return type of the ITD
+ assertEquals("a.b.c.B", theITD.getCorrespondingType(true));
+ List ptypes = theITD.getParameterTypes();
+ for (Iterator iterator = ptypes.iterator(); iterator.hasNext();) {
+ char[] object = (char[]) iterator.next();
+ System.out.println("p = " + new String(object));
+ }
+ ProgramElement decp = (ProgramElement) findElementAtLine(root, 8);
+ m = decp.kvpairs;
+ for (Iterator iterator = m.keySet().iterator(); iterator.hasNext();) {
+ String type = (String) iterator.next();
+ System.out.println(type + " = " + m.get(type));
+ }
+ List l = decp.getParentTypes();
+ assertEquals("java.io.Serializable", (String) l.get(0));
+ ProgramElement ctorDecp = (ProgramElement) findElementAtLine(root, 16);
+ String ctordecphandle = ctorDecp.getHandleIdentifier();
+ assertEquals("=itdfq<a.b.c{A.java}XX)B.B_new)QString;", ctordecphandle); // 252702, comment 7
+ }
+
+ public void testItdProgramElement_pr252702() {
+ String p = "itdpe";
+ AjdeInteractionTestbed.VERBOSE = true;
+ initialiseProject(p);
+ build(p);
+ AsmManager model = getModelFor(p);
+ dumptree(model.getHierarchy().getRoot(), 0);
+ IProgramElement root = model.getHierarchy().getRoot();
+ ProgramElement theITD = (ProgramElement) findElementAtLine(root, 7);
+ Map m = theITD.kvpairs;
+ for (Iterator iterator = m.keySet().iterator(); iterator.hasNext();) {
+ String type = (String) iterator.next();
+ System.out.println(type + " = " + m.get(type));
+ }
+ // return type of the ITD
+ assertEquals("a.b.c.B", theITD.getCorrespondingType(true));
+ List ptypes = theITD.getParameterTypes();
+ for (Iterator iterator = ptypes.iterator(); iterator.hasNext();) {
+ char[] object = (char[]) iterator.next();
+ System.out.println("p = " + new String(object));
+ }
+ ProgramElement decp = (ProgramElement) findElementAtLine(root, 8);
+ m = decp.kvpairs;
+ for (Iterator iterator = m.keySet().iterator(); iterator.hasNext();) {
+ String type = (String) iterator.next();
+ System.out.println(type + " = " + m.get(type));
+ }
+ List l = decp.getParentTypes();
+ assertEquals("java.io.Serializable", (String) l.get(0));
+
+ //
+ }
+
public void testBrokenHandles_pr247742() {
String p = "BrokenHandles";
initialiseProject(p);